scrapyd + scrapyd web

一、在linux下安装并运行scrapyd
系统:centos7

安装scrapyd:pip isntall scrapyd

如果服务器上python2与python3并存应执行的命令是:pip3 isntall scrapyd

安装后新建一个配置文件:

  sudo mkdir /etc/scrapyd

  sudo vim /etc/scrapyd/scrapyd.conf

写入如下内容:

[scrapyd]
eggs_dir    = eggs
logs_dir    = logs
items_dir   =
jobs_to_keep = 5
dbs_dir     = dbs
max_proc    = 0
max_proc_per_cpu = 10
finished_to_keep = 100
poll_interval = 5.0
bind_address = 0.0.0.0
http_port   = 6800
debug       = off
runner      = scrapyd.runner
application = scrapyd.app.application
launcher    = scrapyd.launcher.Launcher
webroot     = scrapyd.website.Root

[services]
schedule.json     = scrapyd.webservice.Schedule
cancel.json       = scrapyd.webservice.Cancel
addversion.json   = scrapyd.webservice.AddVersion
listprojects.json = scrapyd.webservice.ListProjects
listversions.json = scrapyd.webservice.ListVersions
listspiders.json  = scrapyd.webservice.ListSpiders
delproject.json   = scrapyd.webservice.DeleteProject
delversion.json   = scrapyd.webservice.DeleteVersion
listjobs.json     = scrapyd.webservice.ListJobs
daemonstatus.json = scrapyd.webservice.DaemonStatus

主要更改 bind_address=0.0.0.0

我的python3路径: /usr/bin/python3.6.6 找到安装路径里的bin文件里面的scrapyd

创建文件后执行命令启动scrapyd: /usr/bin/python3.6.6/bin/scrapyd

创立软链接

ln -s /usr/bin/python3.6.6/bin/scrapyd /usr/bin/scrapyd

之后执行命令启动scrapyd:scrapyd
scrapyd + scrapyd web_第1张图片
scrapyd + scrapyd web_第2张图片
二、linux下安装scrapyd web
1.在一个服务器上 ScrapydWeb:pip3 install scrapydweb
2.通过运行命令 /usr/bin/python3.6.6/bin/scrapydweb 启动 ScrapydWeb(首次启动将自动在当前工作目录生成配置文件)。
scrapyd + scrapyd web_第3张图片
启用 HTTP 基本认证(可选):

ENABLE_AUTH = True
USERNAME = 'username'
PASSWORD = 'password'

添加 Scrapyd server,支持字符串和元组两种配置格式,支持添加认证信息和分组/标签:

SCRAPYD_SERVERS = [
    '服务器外网ip:端口',
    # 'username:password@localhost:6801#group',
    ('username', 'password', 'localhost', '6801', 'group'),
]

scrapyd + scrapyd web_第4张图片
scrapyd + scrapyd web_第5张图片
圈中配置文件
更多配置请看官网
(1)配置完成之后先启动scrapyd
(2)然后在运行命令/usr/bin/python3.6.6/bin/logparser
(3)最后运行命令 /usr/bin/python3.6.6/bin/scrapydweb 重启 ScrapydWeb

然后访问47.106.113.190:5000输入username和password可以看到scrapydweb的页面
scrapyd + scrapyd web_第6张图片
未完待续。。。。

更多可访问
https://github.com/my8100/files/blob/master/scrapydweb/README_CN.md

你可能感兴趣的:(python,linux,scrapy)