GreatSQL社区

搜索

[已解决] 单机多实例启动失败

883 5 2024-2-18 16:53
单机多服务启动失败,my.cnf 和 greatsql@.service 配置文件在后面,请教cnf文件是否正确?该如何处理
[root@c8-sql clocal]# 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.
[root@c8-sql local]# 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[1]: greatsql@mgr01.service: Control process exited, code=exited status=203
Feb 18 16:47:25 c8-sql systemd[1]: greatsql@mgr01.service: Failed with result 'exit-code'.
Feb 18 16:47:25 c8-sql systemd[1]: Failed to start GreatSQL Server.
Feb 18 16:47:25 c8-sql systemd[1]: greatsql@mgr01.service: Service RestartSec=100ms expired, scheduling restart.
Feb 18 16:47:25 c8-sql systemd[1]: greatsql@mgr01.service: Scheduled restart job, restart counter is at 5.
Feb 18 16:47:25 c8-sql systemd[1]: Stopped GreatSQL Server.
Feb 18 16:47:25 c8-sql systemd[1]: greatsql@mgr01.service: Start request repeated too quickly.
Feb 18 16:47:25 c8-sql systemd[1]: greatsql@mgr01.service: Failed with result 'exit-code'.
Feb 18 16:47:25 c8-sql systemd[1]: Failed to start GreatSQL Server.



my.cnf配置文件

[root@c8-sql local]# cat /etc/my.cnf
[mysql]
socket=/var/lib/mysql/mysql.sock

[mysqld@mgr01]
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



服务文件

[root@c8-sql local]# cat /lib/systemd/system/greatsql\@.service
[Unit]
Description=GreatSQL Server
Documentation=man:mysqld(8)
Documentation=http://dev.mysql.com/doc/refman/en/using-systemd.html
After=network.target
After=syslog.target
[Install]
WantedBy=multi-user.target
[Service]

# 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






全部回复(5)
yejr 2024-2-19 12:06:20
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 配置文件如下:

[root@c8-sql ~]# cat /etc/my.cnf
[mysql]
socket=/var/lib/mysql/mysql.sock

[mysqld@mgr01]
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 配置文件如下:

[root@c8-sql ~]# cat /etc/my.cnf

每个实例指定自己的pid-file,要跟其他实例不一样。
建议先完全按照GreatSQL手册内容做一遍,跑通后再做其他自定义调整。 https://greatsql.cn/docs/8032-25 ... A%E5%AE%9E%E4%BE%8B
lb8125

5

主题

0

博客

13

贡献

新手上路

Rank: 1

积分
20

合作电话:010-64087828

社区邮箱:greatsql@greatdb.com

社区公众号
社区小助手
QQ群
GMT+8, 2024-11-24 13:45 , Processed in 0.019721 second(s), 14 queries , Redis On.
快速回复 返回顶部 返回列表