MySQL Router如何配置成systemd服务自启与异常中止后自愈?
1. mysqlrouter.service配置文件, -c 指定router的配置文件,Restart=on-failure
服务异常奔溃后自愈
cat /usr/lib/systemd/system/mysqlrouter.service
[Unit]
Description=Percona MySQL Router
After=network.target
After=syslog.target
[Service]
Type=notify
User=mysqlrouter
Group=mysqlrouter
# Start main service
ExecStart=/usr/bin/mysqlrouter -c /var/lib/mysqlrouter/mysqlrouter.conf
# Sets open_files_limit
LimitNOFILE = 100000
Restart=on-failure
PrivateTmp=true
[Install]
WantedBy=multi-user.target
2、mysqlrouter配置主机重启后服务自启
[root@test_cdh_001 ~]# systemctl enable mysqlrouter
[root@test_cdh_001 ~]#
[root@test_cdh_001 ~]# systemctl is-enabled mysqlrouter
enabled