I have mysql installed on Ubuntu machine and it is working fine. But as soon as I add the galera conf the mysql doesn't start.
Below is the command I am using.
root#Abhishek-Dev-D1:/usr/local# /etc/init.d/mysql start --wsrep-new-cluster
Starting MySQL
.... * The server quit without updating PID file (/var/run/mysqld/mysqld.pid).
Galera.conf
[mysqld]
binlog_format=ROW
default-storage-engine=innodb
innodb_autoinc_lock_mode=2
bind-address=0.0.0.0
# Galera Provider Configuration
wsrep_on=ON
wsrep_provider=/usr/lib/galera/libgalera_smm.so
# Galera Cluster Configuration
wsrep_cluster_name="test_cluster"
wsrep_cluster_address="gcomm://172.31.254.196,172.31.254.197,172.31.254.198"
# Galera Synchronization Configuration
wsrep_sst_method=rsync
# Galera Node Configuration
wsrep_node_address="172.31.254.196"
wsrep_node_name="node1"
When I remove galera.conf from /etc/mysql/conf.d/galera.conf and then start mysql is starting properly.
When I installed it for the first time it was working fine but then during testing I issued a reboot command on one of the node. After that mysql doesn't booted up with galera.
Related
i have 2 nodes to prepare percona xtradb cluster , i have successfully installed the applications . then I tried to configure the file my.cnf
NODE1 :
cat >>/etc/my.cnf<<EOF
[mysqld]
wsrep_provider=/usr/lib64/galera3/libgalera_smm.so
wsrep_cluster_name=democluster
wsrep_cluster_address=gcomm://192.168.254.126,192.168.254.127
wsrep_node_name=centosvm02
wsrep_node_address=192.168.254.126
wsrep_sst_method=xtrabackup-v2
wsrep_sst_auth=uertest:123abc#A
pxc_strict_mode=ENFORCING
binlog_format=ROW
default_storage_engine=InnoDB
innodb_autoinc_lock_mode=2
EOF
NODE 2 :
cat >>/etc/my.cnf<<EOF
[mysqld]
wsrep_provider=/usr/lib64/galera3/libgalera_smm.so
wsrep_cluster_name=democluster
wsrep_cluster_address=gcomm://192.168.254.126,192.168.254.127
wsrep_node_name=centosvm02
wsrep_node_address=192.168.254.127
wsrep_sst_method=xtrabackup-v2
wsrep_sst_auth=uertest:123abc#A
pxc_strict_mode=ENFORCING
binlog_format=ROW
default_storage_engine=InnoDB
innodb_autoinc_lock_mode=2
EOF
after config is done i started systemctl start mysql#bootstrap but it failed. I discovered an error on startup
enter image description here
The error message is quite clear. The needed library cannot be found. If you installed PXC 8, then the library is galera4, not galera3. Make sure you installed all appropriate packages.
I have 2 nodes and name in hosts is percona1, percona2 .I have successfully installed percona cluster on both nodes. then i started doing config 2 node , i edited the config file my.cnf
# Template my.cnf for PXC
# Edit to your requirements.
[client]
socket=/var/lib/mysql/mysql.sock
[mysqld]
server-id=1
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
# Binary log expiration period is 604800 seconds, which equals 7 days
binlog_expire_logs_seconds=604800
######## wsrep ###############
# Path to Galera library
wsrep_provider=/usr/lib64/galera4/libgalera_smm.so
# Cluster connection URL contains IPs of nodes
#If no IP is found, this implies that a new cluster needs to be created,
#in order to do that you need to bootstrap this node
wsrep_cluster_address=gcomm://percona1,percona2
# In order for Galera to work correctly binlog format should be ROW
binlog_format=ROW
# Slave thread to use
wsrep_slave_threads=8
wsrep_log_conflicts
# This changes how InnoDB autoincrement locks are managed and is a requirement for Galera
innodb_autoinc_lock_mode=2
# Node IP address
wsrep_node_address=percona1
# Cluster name
wsrep_cluster_name=my_centos_cluster
#If wsrep_node_name is not specified, then system hostname will be used
wsrep_node_name=cluster_node_1
#pxc_strict_mode allowed values: DISABLED,PERMISSIVE,ENFORCING,MASTER
pxc_strict_mode=ENFORCING
# SST method
wsrep_sst_method=xtrabackup-v2
After the change work was done I started mysql and got an error , I tried to check every space and got error
enter image description here
I am trying to deploy a mysql cluster (4 machines) with 1 node manager, 1 sql node, and 2 data nodes. I am following these tutorials which are complimentary (first part, second part, third part, fourth part) from the official mysql website. However I have a problem with the SQL Node which is always not connected, as you can see here in the node manager:
$ sudo ndb_mgm -e show
Connected to Management Server at: localhost:1186
Cluster Configuration
---------------------
[ndbd(NDB)] 2 node(s)
id=2 #10.31.35.40 (mysql-5.6.23 ndb-7.4.5, starting, Nodegroup: 0)
id=3 #10.31.35.42 (mysql-5.6.23 ndb-7.4.5, starting, Nodegroup: 0)
[ndb_mgmd(MGM)] 1 node(s)
id=1 #10.31.37.108 (mysql-5.6.23 ndb-7.4.5)
[mysqld(API)] 1 node(s)
id=4 (not connected, accepting connect from 10.31.35.41)
I don't know why the SQL node is not connected to the management node !! I looked for similar problems in google but I still can't resolve my problem !
I tried several times to do:
/etc/init.d/mysql.server stop
and
/etc/init.d/mysql.server start
but in vain.
Here is also the output of mysqld in verbose mode which mentions a problem I don't know what its cause:
ubuntu#10-31-35-41:/usr/local/mysql/bin$ sudo mysqld --verbose --help
150404 5:26:00 [Note] Plugin 'FEDERATED' is disabled.
150404 5:26:00 [ERROR] mysqld: unknown option '--ndbcluster'
......
Also when I try to see the location of the mysqld_safe (which I think is not normal since as you can see in the first part of the tutorial the folder was put in /usr/local/mysql (and I am supposed to use the mysql.server, isn't it ?)), I have
$ which mysqld_safe
/usr/bin/mysqld_safe
Moreover, I don't know if there is a conflict with the previous installed package of mysql
This is /etc/mysql/my.cnf (in the sql node, which is the same in the working data nodes):
[mysqld]
# Options for mysqld process:
ndbcluster # run NDB storage engine
[mysql_cluster]
# Options for MySQL Cluster processes:
ndb-connectstring=10.31.37.108 # location of management server
This is the config.ini file in the ndb_mgm:
[ndbd default]
# Options affecting ndbd processes on all data nodes:
NoOfReplicas=2 # Number of replicas
DataMemory=80M # How much memory to allocate for data storage
IndexMemory=18M # How much memory to allocate for index storage
# For DataMemory and IndexMemory, we have used the
# default values. Since the "world" database takes up
# only about 500KB, this should be more than enough for
# this example Cluster setup.
[tcp default]
# TCP/IP options:
portnumber=2202 # This the default; however, you can use any
# port that is free for all the hosts in the cluster
# Note: It is recommended that you do not specify the port
# number at all and simply allow the default value to be used
# instead
[ndb_mgmd]
# Management process options:
hostname=10.31.37.108 # Hostname or IP address of MGM node
datadir=/var/lib/mysql-cluster # Directory for MGM node log files
[ndbd]
# Options for data node "A":
# (one [ndbd] section per data node)
hostname=10.31.35.40 # Hostname or IP address
datadir=/usr/local/mysql/data # Directory for this data node's data files
[ndbd]
# Options for data node "B":
hostname=10.31.35.42 # Hostname or IP address
datadir=/usr/local/mysql/data # Directory for this data node's data files
[mysqld]
# SQL node options:
hostname=10.31.35.41 # Hostname or IP address
# (additional mysqld connections can be
# specified for this node for various
# purposes such as running ndb_restore)
Thank you very much in advance for your help !!
To resolve the problem I changed the permissions on the /usr/local/mysql/data directory as follows:
sudo chown -R ubuntu data/
so now instead of:
$ /usr/local/mysql/support-files/mysql.server restart
* MySQL server PID file could not be found!
Starting MySQL
. * The server quit without updating PID file (/usr/local/mysql/data/ip-172-31-46-103.pid).
I get now:
$ /usr/local/mysql/support-files/mysql.server restart
Shutting down MySQL
.. *
Starting MySQL
. *
I am trying to configure a mysql cluster in CentOS but i had some issues I dont know how to solve and I would really appreciate some help.
The mysql cluster environment:
DB1 - 192.168.50.101 - Management Server (MGM) node.
DB2 - 192.168.50.102 - Storage Server (NDBD) node 1.
DB3 - 192.168.50.103 - Storage Server (NDBD) node 2.
The steps I followed to configure the whole cluster:
Configure the Management Server node (192.168.50.101)
1.1 Install mysql server and start it:
# yum install mysql mysql-server
# chkconfig --levels 235 mysqld on
# /etc/init.d/mysqld start
1.2 Install cluster packages:
# rpm -ivh MySQL-ndb-management-5.0.90-1.glibc23.i386.rpm
# rpm -ivh MySQL-ndb-tools-5.0.90-1.glibc23.i386.rpm
1.3 Create cluster directory and the config.ini file
# mkdir /var/lib/mysql-cluster
# cd /var/lib/mysql-cluster
# vi config.ini
1.4 write the cluster config content in the config.ini
[NDBD DEFAULT]
NoOfReplicas=2
DataMemory=80M # How much memory to allocate for data storage
IndexMemory=18M # How much memory to allocate for index storage
# For DataMemory and IndexMemory, we have used the
# default values. Since the .world. database takes up
# only about 500KB, this should be more than enough for
# this example Cluster setup.
[MYSQLD DEFAULT]
[NDB_MGMD DEFAULT]
[TCP DEFAULT]
# Management Section (MGM)
[NDB_MGMD]
#NodeId = 1
# IP address of the management node
HostName=192.168.50.101
# Storage Server Section (NDBD)
[NDBD]
#NodeId = 2
# IP address of the Storage Server (NDBD) node 1
HostName=192.168.50.102
DataDir=/var/lib/mysql
BackupDataDir=/var/lib/backup
DataMemory=100M
[NDBD]
#NodeId = 3
# IP address of the Storage Server (NDBD) node 2
HostName=192.168.50.103
DataDir=/var/lib/mysql
BackupDataDir=/var/lib/backup
DataMemory=100M
# one [MYSQLD] per storage node
# 2 Clients MySQL
[MYSQLD]
#NodeId = 5
[MYSQLD]
#NodeId = 6
1.5 Start the Management Service
# ndb_mgmd
1.6 Enter to the admin console
# ndb_mgm
1.7 Use the command SHOW to check the nodes status
ndb_mgm> show
Connected to Managemente Server at: localhost:1186
Cluster Configuration
---------------------
[ndbd(NDB)] 2 nodes
id=2 (not connected, accepting connect from 192.168.50.102)
id=3 (not connected, accepting connect from 192.168.50.103)
[ndb_mgmd(MGM)] 1 node
id=1 #192.168.50.101 (Version: 5.0.95)
[mysqld(API)] 2 nodes
id=5 (not connected, accepting connect from any host)
id=6 (not connected, accepting connect from any host)
The management node configuration is OK, so let's configure one Storage Server node (192.168.50.102).
2.1 Install the mysql server, like the step 1.1 .
2.2 Download the MYSQL Cluster from "http://dev.mysql.com/downloads/cluster/"
2.3 Extract the content and copy the files ndb to /usr/bin/.
2.4 Connect the Storage Server node to the Management Server.
ndbd --connect-string=192.168.50.101 --initial -n
And here is the problem. In the Management Server, the next error is displayed:
ndb_mgm > Node 2: Forced node shutdown completed. Ocurred during startphase 0.
Caused by error 2350: 'Invalid configuration received from Management
Server(Configuration error). Permanent error, external action needed'.
And in the Storage Server node, the displayed warning is:
[ndbd] INFO -- Angel connected to '102.168.50.101:1186'
[ndbd] INFO -- Angel allocated nodeid: 2
[ndbd] WARNING -- Configuration didn't contain generation (likely old ndb_mgmd
Does someone know what I should do to fix the problem?
Thank you!
In case it helps somone else, I'll paste in here the response given on the MySQL Forum...
it looks like you're trying to mix management node binaries from your repository (very old version) with non-Cluster MySQL Server (not allowed) with data nodes from mysql.com (very new).
The first step should be to use binaries for all of the nodes from mysql.com.
If you'd like to try out the browser-driven auto-installer to make your life simpler then take a look at http://www.clusterdb.com/mysql-cluster/auto-installer-labs-release/ or if you'd like to set things up by hand then take a look at http://www.clusterdb.com/mysql-cluster/deploying-mysql-cluster-over-multiple-hosts/
Hello Andrew,
thank you very much for your reply. Indeed, I was using an old mysql version in the mgm node.
I downloaded all from http://www.mysql.com/downloads/cluster/ ,set every node like I said before and connected the data node to the manage node using:
shell> /usr/local/mysql/bin/ndbd --connect-string=192.168.56.101
-- Angel connected to 192.168.56.101:1186
-- Angel allocated nodeid: 2
Also, i checked the manage node using the command show:
ndb_mbm> show
Cluster Configuration
[ndbd(NDB)] 2 nodes
id=2 #192.168.50.102(mysql-5-5.29 ndb-7.2.10, starting, Nodegroup:0)
id=3 (not connected, accepting connect from 192.168.50.103)
[ndb_mgmd(MGM)] 1 node
id=1 #192.168.50.101 (Version: 5.0.95)
[mysqld(API)] 2 nodes
id=5 (not connected, accepting connect from any host)
id=6 (not connected, accepting connect from any host)
As you can see, the data node (id 2) is connecting to the mgm node, but when i try to start the data node (id 2) mysql, it will not start...
shell> /etc/init.d/mysql start
Starting MySQL.................................The server quit without updating PID file (/usr/loca/mysql/data/localhost.node2-1. {FAILED])
I checked the problem, and it seems that mysql does not like the config I wrote in /etc/my.cnf.
At the beggining I had:
-- my.cnf --
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
symbolic-links=0
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
And after I added the ndbcluster config:
-- my.cnf --
[client]
port = 3306
socket = /tmp/mysql.sock
[mysqld]
port = 3306
ndbcluster
ndb-connectstring=192.168.56.107
[mysqld_cluster]
ndb-connectstring=192.168.56.107
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
The thing is if I comment out the ndbluster part, mysql starts correctly, but if the ndbcluster line or the ndb-connectstring line is not commented, mysql does start. What should I do? I do not understand why the mysql does not start when it has the ndbcluster configuration. Is there something wrong?
I notice that you only have one of the two ndbd processes running (and it's still in the starting state). This will prevent the mysqld connecting to the cluster and so you need to start the second ndbd first and wait until ndb_mgm reports them both as being in the running state.
I also tried to connect first both nbdb, but they get stuck on the starting stage:
ndb_mgm> show
Cluster Configuration
[ndbd(NDB)] 2 nodes
id=2 #192.168.50.102(mysql-5-5.29 ndb-7.2.10, starting, Nodegroup:0)
id=3 #192.168.50.103(mysql-5-5.29 ndb-7.2.10, starting, Nodegroup:0)
[ndb_mgmd(MGM)] 1 node
id=1 #192.168.50.101 (mysql-5-5.29 ndb-7.2.10)
[mysqld(API)] 2 nodes
id=5 (not connected, accepting connect from any host)
id=6 (not connected, accepting connect from any host)
I checked the mgm log (ndb_l_cluster.log):
[MgmtSrvr] INFO -- Node 3: Initial start, waiting for 2 to connect, nodes [all: 2 and 3 connected: 3 no-wait:]
[MgmtSrvr] INFO -- Node 2: Initial start, waiting for 3 to connect, nodes [all: 2 and 3 connected: 3 no-wait:]
Even I tried to start them from the mgm:
ndb_mgm> 2 start
Database node 2 is being started.
ndb_mgm> 3 start
Database node 3 is being started.
But there is no "node 2 : Start initiated" message...
I am running the cluster in three virtual machines with CentOS 6.3. Is it the problem? Maybe the config file?
Normally this type of start up problem results from firewall rules blocking access to random high ports on another node in the cluster. Ndbd nodes use these to communicate with each other.
The solution is to either allow all connections between these hosts or to specific ports defined by ServerPort.
See: http://dev.mysql.com/doc/refman/5.5/en/mysql-cluster-ndbd-definition.html#ndbparam-ndbd-serverport
and
http://johanandersson.blogspot.com/2009/05/cluster-fails-to-start-self-diagnosis.html
Matthew, you were right! I allowed the ports between all nodes and all is working fine!
Thank you very much, Matthew and Andrew!
I am having trouble starting up ndb_mgmd. Here's some information.
OS: Ubuntu 12.04LTS
MySQL -V: Ver 5.5.25a-ndb-7.2.7 for Linux on x86_64 (Source distribution)
Base Dir = /usr/local/mysql
Default MySQL Conf = /xconf/mysql/my.cnf
Default MySQL Data = /xdata/mysql
/xconf/mysql/my.cnf
[mysqld]
ndbcluster
socket=/xdata/mysql/mysql.sock
[mysqld_safe]
err-log=/xlog/mysqld.log
pid-file=/xdata/runtime/mysqld/mysqld.pid
[ndb_mgmd]
configdir=/xdata/mysql-cluster
config-file=/xdata/mysql-cluster/config.ini
/xdata/mysql-cluster/config.ini
[NDBD DEFAULT]
NoOfReplicas=2
DataDir=/xdata/mysql-cluster
# Management Node
[ndb_mgmd]
NodeId=1
HostName=192.168.2.100
DataDir=/xdata/mysql-cluster
# Storage Nodes
[ndbd]
NodeId=2
HostName=192.168.2.101
[ndbd]
NodeId=3
HostName=182.168.2.102
# SQL Nodes
[mysqld]
HostName=192.168.2.100
[mysqld]
HostName=192.168.2.101
[mysqld]
HostName=192.168.2.102
When I execute:
#xuser:/xdata/mysql-cluster$ ndb_mgmd
MySQL Cluster Management Server mysql-5.5.25 ndb-7.2.7
[MgmtSrvr] ERROR -- Could not determine which nodeid to use for this node. Specify it with --ndb-nodeid=<nodeid> on command line
Any ideas as to why this is happening?
The problem was I wasn't connected to the network of the cluster.