Skip to content

Instantly share code, notes, and snippets.

@foxutech
Created November 26, 2018 19:37
Show Gist options
  • Save foxutech/efb762a144ca7bbd18a959aeab166e20 to your computer and use it in GitHub Desktop.
Save foxutech/efb762a144ca7bbd18a959aeab166e20 to your computer and use it in GitHub Desktop.
Step1: On management node, create the config file(if not exists)
# vim /var/lib/mysql-cluster/config.ini {{ replace IP with your node server hostname/IP }}
[[ copy the config.ini file in attachment ]]
We can now start the manager by executing the ndb_mgmd binary and specifying its config file using the -f flag:
# ndb_mgmd -f /var/lib/mysql-cluster/config.ini
Step2: enable executable permission to the script
Before we create the service, we need to kill the running server:
# pkill -f ndb_mgmd
# vim /etc/systemd/system/ndb_mgmd.service
## added this content, DONOT COPY THIS LINE ##
[Unit]
Description=MySQL NDB Cluster Management Server
After=network.target auditd.service
[Service]
Type=forking
ExecStart=/usr/sbin/ndb_mgmd -f /var/lib/mysql-cluster/config.ini
ExecReload=/bin/kill -HUP $MAINPID
KillMode=process
Restart=on-failure
[Install]
WantedBy=multi-user.target
### STILL HERE DONT COPY THIS LINE##
Step3: Start/stop/restart the service
Now you can start/stop/restart using following command
Run the daemon-reload to reload systemd manager.
# systemctl daemon-reload
To enable:
# systemctl enable ndb_mgmd
To Start
# systemctl start ndb_mgmd
To Stop
# systemctl stop ndb_mgmd
To check status
# systemctl status ndb_mgmd
Step4: Add ndb_mgmd config file path in mysql config {{ in node server }}
# vim my.cnf
add below lines {{ replace 192.168.254.51 with management node IP/hostname }}
[MYSQLD]
ndbcluster
ndb-connectstring=192.168.254.51
[MYSQL_CLUSTER]
ndb-connectstring=192.168.254.51
[ndbd]
connect-string=192.168.254.51
[ndb_mgmd]
config-file=/var/lib/mysql-cluster/config.ini
Step5: enable executable pe rmission to the script
# vim /etc/systemd/system/ndbd.service
## added this content, DONOT COPY THIS LINE ##
[Unit]
Description=MySQL NDB Data Node Daemon
After=network.target auditd.service
[Service]
Type=forking
ExecStart=/usr/sbin/ndbd
ExecReload=/bin/kill -HUP $MAINPID
KillMode=process
Restart=on-failure
[Install]
WantedBy=multi-user.target
### STILL HERE DONT COPY THIS LINE##
Run the daemon-reload to reload systemd manager.
# systemctl daemon-reload
To enable:
# systemctl enable ndbd
To Start
# systemctl start ndbd
To Stop
# systemctl stop ndbd
To check status
# systemctl status ndbd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment