Search code examples
mysqlsqldatabasemysql-cluster

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 !!


Solution

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