4.启动后台队列服务
等待初始化数据和修复完成后,需要配置后台队列服务,队列服务需要配置服务器守护进程,必须用服务器管理员即root用户操作,本次采用的是CentOS7自带的systemd守护,适用服务器Linux3.0以上内核版本,如CentOS7,CentOS8等,守护队列服务和开机启动;
写入systemd队列服务启动脚本 ,在/lib/systemd/system
目录下新建一个renrenshop_queue.service
文件,填入如下内容,其中WorkingDirectory
项为您的商城模块安装目录,ExecStart
项目第一个参数是php7.1的命令行路径,这两项需要按照您的服务器情况来填写,不可以直接复制这里的配置信息。
[Unit]
Description=kdx_shop queue service
After=network.target
[Service]
Type=simple
User=www
ExecStart=/www/server/php/71/bin/php console queue/listen
WorkingDirectory=/www/wwwroot/www.xxx.com/kdx_shop
ExecStop=/bin/kill -s QUIT $MAINPID
Restart=on-failure
RestartSec=3s
[Install]
WantedBy=multi-user.target
systemctl daemon-reload
systemctl enable kdx_shop_queue.service
systemctl start kdx_shop_queue.service
systemctl status kdx_shop_queue.service
返回绿色active如下说明队列服务启动成功
