mysql-cluser ndb_restore issue - mysql

I've been trying with intermittent success to restore my ndb_backups to a new cluster.
We have a 6 NDB node cluster with 3 API nodes. When I run an ndb_restore, usually the first 2 or 3 node backups get pulled in without issue. But the 4th and 5th node fail with the following error:
Temporary error: 266: Time-out in NDB, probably caused by deadlock
Temporary error: 266: Time-out in NDB, probably caused by deadlock
Retried transaction 10 times.
Last error266: Time-out in NDB, probably caused by deadlock
...Unable to recover from errors. Exiting...
Strangely, sometimes I can simply rerun all 6 backups and it finishes successfully.
I'm hoping someone knows what kind of tweaks I can make to my configuration to optimize this process. Here are my version numbers and configs:
mysql-5.6.22 ndb-7.3.8
My mgm configuration file:
######################
#MGM CONFIG
######################
[ndbd default]
# Options affecting ndbd processes on all data nodes:
NoOfReplicas=2 # Number of replicas
DataMemory=8144M # How much memory to allocate for data storage
IndexMemory=8144M # 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.
[ndb_mgmd]
# Management process options:
hostname=192.168.207.133 # Hostname or IP address of MGM node
NodeId=1
[ndb_mgmd]
# Management process options:
hostname=192.168.207.45 # Hostname or IP address of MGM node
NodeId=2
[ndbd]
# Options for data node "A":
hostname=192.168.207.135 # Hostname or IP address
NodeId=3
[ndbd]
# Options for data node "B":
hostname=192.168.207.171 # Hostname or IP address
NodeId=4
[ndbd]
# Options for data node "C":
hostname=192.168.207.174 # Hostname or IP address
NodeId=5
[ndbd]
# Options for data node "D":
hostname=192.168.207.27 # Hostname or IP address
NodeId=6
[ndbd]
# Options for data node "E":
hostname=192.168.207.169 # Hostname or IP address
NodeId=7
[ndbd]
# Options for data node "F":
hostname=192.168.207.178 # Hostname or IP address
NodeId=8
[mysqld]
hostname=192.168.207.177
NodeId=10
[mysqld]
hostname=192.168.207.35
NodeId=11
[mysqld]
hostname=192.168.207.148
NodeId=12
My mysqld and ndb node config
######################
#API AND NDB CONFIG
######################
[mysqld]
ndbcluster
[mysql_cluster]
ndb-connectstring=192.168.207.133,192.168.207.45 # location of management server
Really hope someone can help. I've been at this for a month. We use data blobs quite extensively and I understand that this can cause these time-outs, but I'm most curious to find out why the 6-node restore sometimes succeeds and sometimes doesn't, and how I can go about ensuring the restore is successful every time.
I'm very open to try things and repost. I'm new to mysql cluster and have learned piles in the past few months, but am eager to learn more.
Thanks in advance,
GT

Related

config percona xtradb cluster erro

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

why did the error "The hostname this node should have according to the configuration does not match a local interface" occur?

Host1:
ip: 42.a1.b1.c1 (in configuration file, a1,b1,c1 will be replaced by real values.)
mysql-cluster-community-server, mysql-cluster-community-management-server and mysql-cluster-community-data-node are all installed on this host.
Host2:
ip: 119.a2.b2.c2 (in configuration file, a2,b2,c2 will be replaced by real values.)
Both mysql-cluster-community-server and mysql-cluster-community-data-node are installed on this host.
All mysql-cluster-* softwares on both hosts didn't start.
cat /var/lib/mysql-cluster/config.ini on host1 outputs:
[ndbd default]
# Options affecting ndbd processes on all data nodes:
NoOfReplicas=1 # Number of fragment 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 NDB Cluster setup.
# NOTE: IndexMemory is deprecated in NDB 7.6 and later; in
# these versions, resources for all data and indexes are
# allocated by DataMemory and any that are set for IndexMemory
# are added to the DataMemory resource pool
ServerPort=2202 # This the default value; however, you can use any
# port that is free for all the hosts in the cluster
# Note1: It is recommended that you do not specify the port
# number at all and simply allow the default value to be used
# instead
# Note2: The port was formerly specified using the PortNumber
# TCP parameter; this parameter is no longer available in NDB
# Cluster 7.5.
[ndb_mgmd]
# Management process options:
HostName=42.a1.b1.c1 # Hostname or IP address of management node
DataDir=/var/lib/mysql-cluster # Directory for management node log files
#[ndbd]
#Options for data node "A":
# (one [ndbd] section per data node)
#HostName=42.a1.b1.c1 # Hostname or IP address
#NodeId=2 # Node ID for this data node
#DataDir=/usr/local/mysql/data # Directory for this data node's data files
[ndbd]
#Options for data node "B":
HostName=119.a2.b2.c2 # Hostname or IP address
NodeId=3 # Node ID for this data node
DataDir=/usr/local/mysql/data # Directory for this data node's data files
[mysqld]
#SQL node options:
HostName=119.a2.b2.c2 # Hostname or IP address
# (additional mysqld connections can be
# specified for this node for various
# purposes such as running ndb_restore)
ndb_mgmd -f /var/lib/mysql-cluster/config.ini --ndb-nodeid=1 on host1 outpus:
MySQL Cluster Management Server mysql-5.7.32 ndb-7.6.16
2020-11-07 16:35:20 [MgmtSrvr] WARNING -- at line 5: [DB] IndexMemory is deprecated, will use Number bytes on each ndbd(DB) node allocated for storing indexes instead
2020-11-07 16:35:20 [MgmtSrvr] ERROR -- The hostname this node should have according to the configuration does not match a local interface. Attempt to bind '42.a1.b1.c1' failed with error: 99 'Cannot assign requested address'
why did the error "The hostname this node should have according to the configuration does not match a local interface" occur?
thanks a lot.
Happen because /etc/hosts has not been loaded in ram at boot time when your ndb service load.
i do resolve this on my case just adding 5 sec pause into the service script.
detail:
[Service]
ExecStartPre=-/bin/sleep 5

SQL Node not connected in a mysql cluster

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
. *

Error starting mysql cluster management node (ndb_mgmd) on Ubuntu

I am having trouble with the initial start up of the mysql-cluster management node and would appreciate any help I can get about this issue. See my two examples of failure below followed by my config.ini file. The first example shows the basic command to start the daemon and the error it produces. The second attempts to skip the process I believe caused the error in the first, but only results in a different error (one that I can find no solution to).
~$ ndb_mgmd -f /var/lib/mysql-cluster/config.ini
MySQL Cluster Management Server mysql - 5.5.25 ndb-7.2.7
2012-07-27 16:44:51 [MgmtSrvr] INFO -- The default config directory '/user/local
/mysql/mysql-cluster' does not exist. Trying to create it...
Failed to create directory '/usr/local/mysql/mysql-cluster', error: 2 2012-07-27 16:44:51
[MgmtSrvr] ERROR -- Could not create directory '/usr/local/mysql/mysql-cluster'.
Either create it manually or specify a different directory with --configdir=
~$ ndb_mgmd --skip-config-cache -f /var/lib/mysql-cluster/config.ini
MySQL Cluster Management Server mysql - 5.5.25 ndb-7.2.7
2012-07-27 16:44:51 [MgmtSrvr] INFO -- Skipping check of config directory since config cache is disabled.
Failed to parse parameters for log handler: 'FILE:filename=/var/lib/mysql-cluster/ndb_1_cluster.log,maxsize=1000000,
maxfiles=6', error:13 '(null)'
/var/lib/mysql-cluster/config.ini:
[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
[tcp default]
# TCP/IP options:
[ndb_mgmd]
# Management process options:
hostname=192.168.0.3 # Hostname or IP address of MGM node
datadir=/var/lib/mysql-cluster # Directory for MGM node log files
NodeId=1
[ndbd]
# Options for data node-1:
# (one [ndbd] section per data node)
hostname=192.168.0.1 # Hostname or IP address
datadir=/usr/local/mysql/data # Directory for this data node's data files
NodeId=2
[ndbd]
# Options for data node-2:
hostname=192.168.0.2 # Hostname or IP address
datadir=/usr/local/mysql/data # Directory for this data node's data files
NodeId=3
[mysqld]
# SQL node options:
hostname=192.168.0.4 # Hostname
You should try running that commands with sudo:
~$ sudo ndb_mgmd -f /var/lib/mysql-cluster/config.ini
~$ sudo ndb_mgmd --skip-config-cache -f /var/lib/mysql-cluster/config.ini
Your problem seems to be with permissions, not configuration.

mysql ndb cluster add data node

This is my config.ini file
options affecting ndbd processes on all data nodes:
[ndbd default]
NoOfReplicas=1 # 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/IP options:
[tcp default]
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 allow the default value to be used instead
Management process options:
[ndb_mgmd]
hostname=192.168.1.10 # Hostname or IP address of management node
datadir=/var/lib/mysql-cluster # Directory for management node log files
Options for data node "A":
[ndbd]
# (one [ndbd] section per data node)
hostname=192.168.1.10 # Hostname or IP address
datadir=/usr/local/mysql/data # Directory for this data node's data files
Options for data node "B":
[ndbd]
hostname=192.168.0.20 # Hostname or IP address
datadir=/usr/local/mysql/data # Directory for this data node's data files
SQL node options:
[mysqld]
hostname=192.168.1.10 # Hostname or IP address
# (additional mysqld connections can be
# specified for this node for various
# purposes such as running ndb_restore)
I want to specify second data node on 192.168.0.20 server.
What changes do i need to do on 192.168.0.20? It is a very low end machine so, I want don't want mysqld to run there.
can anyone provide any input on this.
If you use http://www.severalnines.com/config/index.php to create configurations files, and ask it to send it to you as an e-mail, you will get several scripts, including add_node.sh, which might be what you need.