lb8125 发表于 2024-2-18 16:53:09

单机多实例启动失败

单机多服务启动失败,my.cnf 和 greatsql@.service 配置文件在后面,请教cnf文件是否正确?该如何处理
# systemctl start greatsql@mgr01
Job for greatsql@mgr01.service failed because the control process exited with error code.
See "systemctl status greatsql@mgr01.service" and "journalctl -xe" for details.
# systemctl status greatsql@mgr01.service
● greatsql@mgr01.service - GreatSQL Server
   Loaded: loaded (/usr/lib/systemd/system/greatsql@.service; disabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Sun 2024-02-18 16:47:25 CST; 26s ago
   Docs: man:mysqld(8)
         http://dev.mysql.com/doc/refman/en/using-systemd.html
Process: 18079 ExecStartPre=/usr/local/GreatSQL-8.0.32-24-Linux-glibc2.28-x86_64/bin/mysqld_pre_systemd mgr01 (code=exited, status=203/EXEC)

Feb 18 16:47:25 c8-sql systemd: greatsql@mgr01.service: Control process exited, code=exited status=203
Feb 18 16:47:25 c8-sql systemd: greatsql@mgr01.service: Failed with result 'exit-code'.
Feb 18 16:47:25 c8-sql systemd: Failed to start GreatSQL Server.
Feb 18 16:47:25 c8-sql systemd: greatsql@mgr01.service: Service RestartSec=100ms expired, scheduling restart.
Feb 18 16:47:25 c8-sql systemd: greatsql@mgr01.service: Scheduled restart job, restart counter is at 5.
Feb 18 16:47:25 c8-sql systemd: Stopped GreatSQL Server.
Feb 18 16:47:25 c8-sql systemd: greatsql@mgr01.service: Start request repeated too quickly.
Feb 18 16:47:25 c8-sql systemd: greatsql@mgr01.service: Failed with result 'exit-code'.
Feb 18 16:47:25 c8-sql systemd: Failed to start GreatSQL Server.



my.cnf配置文件

# cat /etc/my.cnf

socket=/var/lib/mysql/mysql.sock


user=mysql
datadir=/data/GreatSQL/mgr01
socket=/data/GreatSQL/mgr01/mysql.sock
port=3306
server_id=33061
log-error=/data/GreatSQL/mgr01/error.log

pid-file=/var/run/mysqld/mysqld.pid



服务文件

# cat /lib/systemd/system/greatsql\@.service

Description=GreatSQL Server
Documentation=man:mysqld(8)
Documentation=http://dev.mysql.com/doc/refman/en/using-systemd.html
After=network.target
After=syslog.target

WantedBy=multi-user.target


# some limits
# file size
LimitFSIZE=infinity
# cpu time
LimitCPU=infinity
# virtual memory size
LimitAS=infinity
# open files
LimitNOFILE=65535
# processes/threads
LimitNPROC=65535
# locked memory
LimitMEMLOCK=infinity
# total threads (user+kernel)
TasksMax=infinity
TasksAccounting=false

User=mysql
Group=mysql
#如果是GreatSQL 5.7版本,此处需要改成simple模式,否则可能服务启用异常
#如果是GreatSQL 8.0版本则可以使用notify模式
#Type=simple
Type=notify
TimeoutSec=0
PermissionsStartOnly=true

#ExecStartPre=/usr/local/GreatSQL-8.0.32-25-Linux-glibc2.28-x86_64/bin/mysqld_pre_systemd
#ExecStart=/usr/local/GreatSQL-8.0.32-25-Linux-glibc2.28-x86_64/bin/mysqld $MYSQLD_OPTS

#for multi instance
ExecStartPre=/usr/local/GreatSQL-8.0.32-24-Linux-glibc2.28-x86_64/bin/mysqld_pre_systemd %I
ExecStart=/usr/local/GreatSQL-8.0.32-24-Linux-glibc2.28-x86_64/bin/mysqld --defaults-group-suffix=@%I $MYSQLD_OPTS

EnvironmentFile=-/etc/sysconfig/mysql
LimitNOFILE = 10000
Restart=on-failure
RestartPreventExitStatus=1
Environment=MYSQLD_PARENT_PID=1
PrivateTmp=false
PrivateTmp=false






yejr 发表于 2024-2-19 12:06:20

可以参考这篇文档 https://greatsql.cn/docs/8032-25/user-manual/6-oper-guide/5-multi-instances.html#%E5%8D%95%E6%9C%BA%E5%A4%9A%E5%AE%9E%E4%BE%8B

lb8125 发表于 2024-2-19 13:49:09

yejr 发表于 2024-2-19 12:06
可以参考这篇文档 https://greatsql.cn/docs/8032-25/user-manual/6-oper-guide/5-multi-instances.html#%E ...

除了上面链接中的配置项,关于my.cnf 配置文件能提供一个完整模板吗? 我在快速安装的基础上更改过来的cnf配置文件,服务就是无法启动

yejr 发表于 2024-2-19 16:22:49

lb8125 发表于 2024-2-19 13:49
除了上面链接中的配置项,关于my.cnf 配置文件能提供一个完整模板吗? 我在快速安装的基础上更改过来的cn ...

你先提供完整的my.cnf吧,看起来是你配置有问题,例如
pid-file=/var/run/mysqld/mysqld.pid

这是每个实例要有个独立的pid file,你这里似乎共用了。

lb8125 发表于 2024-2-27 21:32:48

yejr 发表于 2024-2-19 16:22
你先提供完整的my.cnf吧,看起来是你配置有问题,例如
pid-file=/var/run/mysqld/mysqld.pid



我的my.cnf 配置文件如下:

# cat /etc/my.cnf

socket=/var/lib/mysql/mysql.sock


user=mysql
datadir=/data/GreatSQL/mgr01
socket=/data/GreatSQL/mgr01/mysql.sock
port=3306
server_id=33061
log-error=/data/GreatSQL/mgr01/error.log

pid-file=/var/run/mysqld/mysqld.pid
-----------------------------------------------------

yejr 发表于 2024-2-28 09:14:00

lb8125 发表于 2024-2-27 21:32
我的my.cnf 配置文件如下:

# cat /etc/my.cnf


每个实例指定自己的pid-file,要跟其他实例不一样。
建议先完全按照GreatSQL手册内容做一遍,跑通后再做其他自定义调整。 https://greatsql.cn/docs/8032-25/user-manual/6-oper-guide/5-multi-instances.html#%E5%8D%95%E6%9C%BA%E5%A4%9A%E5%AE%9E%E4%BE%8B
页: [1]
查看完整版本: 单机多实例启动失败