linux centos7 安装beanstalk
第一步
安装命令:yum install beanstalkd
第二步:
设置开机自启动命令:systemctl enable beanstalkd.service
第三步:
检查是否安装完成:
1):cd /usr/lib/systemd/system
2):ll |grep beanstalkd
第四步:
编辑beanstalkd配置文件:vi /etc/sysconfig/beanstalkd
端口号改成跟项目一样的 绿色的框全部去掉#打开 写入日志方式some-value 改成60000 编辑完事:wq 保存
重载命令:systemctl daemon-reload 启动服务:systemctl start beanstalkd.service
查看服务( active(running)启动成功):systemctl status beanstalkd.service
第五步:
添加任务(通道名称自己随便起,最后项目里的通道名和自己配置的名字保持一致就行了):
新建服务:touch test.service
编辑新建的服务:vi test.service
下面这个复制到编辑的文件里:
[Unit]
Description=consumer service
After=network.target
After=syslog.target
[Service]
Type=simple
LimitNOFILE=35555
ExecStart=/www/server/php/72/bin/php /www/wwwroot/test/think test
ExecReload=/bin/kill -USR1 $MAINPID
Restart=always
[Install]
WantedBy=multi-user.target graphical.target
ExecStart 参数配置:ExecStart=/www/server/php/72/bin/php /www/wwwroot/test/think test
/www/server/php/72/bin/php 是php的运行目录
/www/wwwroot/test/think 是运行目录,我用的是thinkphp5框架,其他框架自行配置
test 是通道名称,填上面配置好的通道名就行
第六步
重启服务,查看运行状态:
重新启动:systemctl enable /usr/lib/systemd/system/test.service
重载:systemctl daemon-reload 开始:systemctl start test.service
查看状态:systemctl status test.service