阿里雲ECS雲服務器php
CPU:1核python
內存:2Gmysql
操做系統:Centos 7.3 x64nginx
地域:華北 2(華北 2 可用區 A)c++
系統盤:40Gweb
yum install gcc gcc-c++ python-pip python-devel python-distribute libxml2 libxml2-devel python-lxml libxslt libxslt-devel openssl openssl-devel
pip install --upgrade pip
pip install pyspider
mysql安裝及配置過程能夠查看
nginx + php + mysql + wordpress 搭建簡單站點 安裝及配置過程redis
yum install redis pip install redis
systemctl start redis
pip install mysql-connector
vim /etc/pyspider/pyspider.conf.json
內容以下sql
其中mysqlUser爲mysql用戶名,mysqlPasswd爲mysql密碼,webuiUser爲登陸控制檯的用戶名,webuiPasswd爲登錄控制檯的密碼json
{ "taskdb": "mysql+taskdb://mysqlUser:mysqlPasswd@127.0.0.1:3306/taskdb", "projectdb": "mysql+projectdb://mysqlUser:mysqlPasswd@127.0.0.1:3306/projectdb", "resultdb": "mysql+resultdb://mysqlUser:mysqlPasswd@127.0.0.1:3306/resultdb", "message_queue": "redis://127.0.0.1:6379/db", "webui": { "username": "webuiuser", "password": "webuipasswd", "need-auth": true } }
pyspider -c /etc/pyspider/pyspider.conf.json
後臺運行vim
nohup pyspider -c /etc/pyspider/pyspider.conf.json &
也能夠將以上命令寫進bashrc裏,直接使用pyspider命令在後臺啓動
vim .bashrc
添加以下內容
alias pyspider = 'nohup pyspider -c /etc/pyspider/pyspider.conf.json &'
地址:5000