-
Notifications
You must be signed in to change notification settings - Fork 128
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
更新拨号策略实现拨号的稳定和监控 #12
Open
chenxuzhen
wants to merge
15
commits into
Python3WebSpider:master
Choose a base branch
from
chenxuzhen:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
更新拨号策略实现拨号的稳定和监控 #12
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 采用了新的proxy验证方式,ping一次速度更快 # 修正了原来版本的几个小bug,比如拨号间隔原来实际上是设定值的两倍,如果proxy无效等待时间太长(改成6秒或者其他最低拨号间隔即可) # IP与上次的相同会自动再次拨号
放入Redis之前加了一个时间戳,方便判断IP存活时间
# 采用了新的proxy验证方式,ping一次速度更快 # 修正了原来版本的几个小bug,比如拨号间隔原来实际上是设定值的两倍,如果proxy无效等待时间太长(改成6秒或者其他最低拨号间隔即可) # IP与上次的相同会自动会重新拨号 # 连续三次拨号失败自动重启(ADSL VPS这种情况下基本上等于无法继续拨号了) # 增加邮件提醒 # 每次拨出的IP存入redis,方便统计和去重.IP出现2次以上会重新拨号 # 从redis移除移除IP失败立即重启,这个情况下VPS通常已经无法拨号了
邮件提醒,一定要注意163邮箱反垃圾措施,注意邮件内容和标题
增加阿里云setup.py,用户在运行python setup.py时会使用阿里云pip源,加快安装速度
service.sh文件放在/etc/init.d目录下并且在/etc/rc.local最后添加bash /etc/init.d/service.sh,系统重启后会自动运行拨号脚本.
github hosts.以便国内用户访问github相关页面
IP PROXY监控脚本,seaborn可视化IP代理统计数据
1. 增加邮件提醒 2. 修正拨号间隔错误,原脚本的小bug,拨号间隔会是settings中的两倍 3. 增加拨号统计:每次拨出的IP放入redis,每拨一次value +1,如果是2会重新拨号,防止重复IP出现.如果需要可以重置下这个频次的值,参考proxy_reset.py.这个考虑到平台对IP的封禁并非长期,通常24小时后能解封 4. 增加拨号日志可视化监控,在本地运行proxy_stats.py读取远程拨号服务器日志并可视化展示拨号状态,比如这里的adsl1_proxy_quality_monitor.jpg 5. 连续三次拨号无效IP系统会重启,因为这时候服务器已经不能继续拨号了 6. 从redis删除IP失败系统会重启,这个时候一般都是无法拨号了 7. 更新proxy检测方式为ping,拨号一次只需要6-7秒(当然和代理商有关系).这个针对单地区adsl vps特别有效,因为单地区拨号服务器带宽都没问题,拨出的IP都很稳定,只要能ping通都是高速可用的.个人建议 抛弃混拨服务器,带宽低而且拨号慢,不如多个地区的组合.本人测试过三家的拨号服务器,如有需要可提供免费建议. 8. service.sh放到/etc/init.d目录下, /bin/bash /etc/init.d/service.sh放在/etc/rc.local最后,系统重启后会自动运行拨号脚本. 9. 基于以上更新,脚本可以长期运行
ip代理服务器拨号统计可视化
update stats image
因为网站封禁IP并非长期,24小时后可以运行该脚本减小拨号出现次数的值,提高IP利用率
拨号服务器一键部署脚本,只需要输入squid代理的密码,用户名这里是czhen,可以自己修改.注意,这里增加了一段修改sshd端口的脚本,如果服务器没有端口冲突问题这段代码需要hash掉
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
4.参考proxy_reset.py.这个考虑到平台对IP的封禁并非长期,通常24小时后能解封
基于以上更新,脚本可以长期运行而不会出现拨号失败无法继续拨号的问题,并且可以方便地在本地机器监控远程服务器拨号状态.