Skip to content
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

配置设置问题咨询 #29

Open
gitzwt opened this issue Dec 14, 2018 · 9 comments
Open

配置设置问题咨询 #29

gitzwt opened this issue Dec 14, 2018 · 9 comments
Assignees
Labels
good first issue Good for newcomers

Comments

@gitzwt
Copy link

gitzwt commented Dec 14, 2018

SMProxy的账号密码端口和ip能设置与原mysql一样的吗?比如都设置为 127.0.0.1 root 123456 3306
目的是为了防止这个访问突然断了后直接连回mysql,或者说这服务有守护进程在的吗?服务挂了会重启或服务器挂了重启它也跟着重启而不需要手动启动

@wi1dcard
Copy link
Collaborator

不可以,会造成端口冲突。如果想要服务挂了自动连回 MySQL,可以通过配置负载均衡实现。

@wi1dcard
Copy link
Collaborator

另外,你可以使用 Supervisor 配置守护进程;或者使用 Daemonize Mode;或者使用 Swoole 官方给出的 cron 方案。

@gitzwt
Copy link
Author

gitzwt commented Dec 14, 2018

好的,谢谢

@gitzwt
Copy link
Author

gitzwt commented Dec 14, 2018

系统的crontab中加入:
*/1 * * * * /data/SMProxy/script/check_server.sh

/data/SMProxy/script/check_server.sh:
count=ps -fe |grep "SMProxy" | grep -v "grep" | grep "master" | wc -l echo $count if [ $count -lt 1 ]; then ps -eaf |grep "SMProxy" | grep -v "grep"| awk '{print $2}'|xargs kill -9 sleep 2 ulimit -c unlimited /usr/local/bin/php /data/SMProxy/bin/SMProxy echo "restart"; echo $(date +%Y-%m-%d_%H:%M:%S) >/data/log/restart.log fi

船哥方便教下这cron的定时器脚本怎么修改吗

@gitzwt
Copy link
Author

gitzwt commented Dec 14, 2018

SMProxy服务或Swoolw服务如果挂掉这一问题后续版本里是要考虑加上解决方法的吧

@wi1dcard
Copy link
Collaborator

@louislivi

@louislivi
Copy link
Owner

使用supervisor或者docker挂载服务

@louislivi louislivi added the good first issue Good for newcomers label Dec 27, 2018
@snakeliwei
Copy link

snakeliwei commented Feb 20, 2019

其实用systemd 服务也挺好的

[Unit]
Description=SMProxy Service
After=network.target
After=mysqld.service
After=php-fpm-71.service

[Service]
Type=simple
ExecStart=/home/www/server/smproxy/SMProxy start --console --config /home/www/server/smproxy/conf
ExecReload=/home/www/server/smproxy/SMProxy reload
ExecStop=/home/www/server/smproxy/SMProxy stop
Restart=always
RestartSec=30
PrivateTmp=True

[Install]
WantedBy=multi-user.target

@undedo
Copy link

undedo commented May 13, 2021

请问 支持 swoole 4.5+ 吗?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

5 participants