MySQL Cluster 7.2.4 Cluster configuration

Source: Internet
Author: User
Tags decompress file node server

MySQL Cluster 7.2.4 Cluster configuration preparation 32-bit and 64-bit versions 3 servers 202.38.128.153 dbs2 64-bit 202.122.32.68 dbs1 64-bit 192.168.32.22 erpdbtest 32-bit management node (ndb_mgmd) 192.168.32.22 erpdbtest 32-bit data node (ndbd) 202.122.32.68 dbs1 64-bit 202.38.128.153 dbs2 64-bit SQL node (mysqld) 202.122.32.68 dbs1 64-bit 202.38.128.153 dbs2 64-bit wget http://dev.mysql.com/get/Downloads/MySQL-Cluster-7.2/mysql-cluster-gpl-7.2.4-linux2.6-i686.tar.gz/from/http://gd.tuwien.ac.at/db/mysql/ www.2cto.com uninstall Mysql rpm-qa | grep SQLrpm-e mysql... delete/etc/my. cnf/var/lib/mysql
Disable firewall Iptables is a firewall that is included in most Linux releases. In the RHEL installed by default, the firewall is opened and started randomly. to disable the firewall, run the following command: after running the service iptables stop and above commands, the effect can only be maintained until the next restart. After the restart, the configuration is restored. If you want to disable the firewall after the restart, run the following command: chkconfig-level 35 iptables off.
Security-EnhancedLinux is the access control system developed by the National Security Agency (NSA. SELinux can maximize the security of Linux systems. In the default Linux system, SELinux is enabled by default, and the configuration file is/etc/selinux/config. Generally, the "permissive" mode is used during the test, in this way, only a warning is issued when the SELinux rule is violated, and then the rule is modified. Finally, the user determines whether to execute a strict "enforcing" policy to prohibit the violation of the rule policy. The rules determine SELinux's work behavior and method, and the policy determines the specific security details, such as file system and file consistency. During installation, you can select "Activate", "warning", or "Disable" SELinux. The default value is "Activate ".
To prevent SELinux from affecting the cluster function, disable the SELinux system function 1. Install the management node (192.168.32.22) decompress the file www.2cto.com tar-zvxf mysql-cluster-gpl-7.2.4-linux2.6-i686.tar.gz to create the installation directory mkdir-p/usr/local/mysql/bin mkdir-p/usr/local/mysql/ndbdata to add the execution file path vi ~ /. Bash_profile PATH = $ PATH: $ HOME/bin: /usr/local/mysql/bin copy the execution file cd mysql-cluster-gpl-7.2.4-linux2.6-i686cp bin/ndb_mgmd/usr/local/mysql/bincp bin/ndb_mgm/usr/local/mysql/bin create the log file storage directory mkdir/var/lib/mysql-cluster create the configuration file directory and file mkdir/usr/local/mysql/cluster-conf vi/usr/local/mysql/cluster-conf/config. ini: ######################## the following configuration file content ########### ###### [ndbd default] NoOfReplicas = 2 # copy a member DataMemory = 80 M # Memory allocated for data storage IndexMemory = 18 M # Memory allocated for index storage [ndb_mgmd] # define the IP address or host name id of the Management node = 1 hostname = 192.168.32.22 dataDir =/var/lib/mysql-cluster [ndbd] # define data node id = 11 HostName = 202.122.32.68 DataDir =/usr/local/mysql/ndbdata [ndbd] www.2cto.com id = 12 hostName = metric =/usr/local/mysql/ndbdata [mysqld] # define SQL node id = 21 HostName = 202.122.32.68 [mysqld] id = 22 HostName = 202.38.128.153 [mysqld] id = 23 ## ###################### The preceding configuration file content ############# #### 2. Install the data node (202.122.32.68 dbs1 202.38.128.153 dbs2) decompress the file tar-zxvf mysql-cluster-gpl-7.2.4-linux2.6-x86_64.tar.gz to create the installation directory mkdir-p/usr/local/mysql/binmkdir-p/usr/local/mysql/ndbdata copy the execution file cp mysql-cluster-gpl-7.2.4-linux2.6-x86_64/bin/ndbd/ usr/local/mysql/bin Add the execution file path vi ~ /. Bash_profilePATH = $ PATH: $ HOME/bin:/usr/local/mysql/bin create a configuration file: vi/etc/my. cnf adds the following content to the Host: [mysql_cluster] # configure the data node connection management node ndb-connectstring = 192.168.32.223 and install the SQL node (202.122.32.68 dbs1 202.38.128.153 dbs2 ): decompress file tar-zxvf mysql-cluster-gpl-7.2.4-linux2.6-x86_64.tar.gz copy Installation File mv mysql-cluster-gpl-7.2.4-linux2.6-x86_64/usr/local/mysql add mysql user groupadd mysqluseradd-g mysql add permission chown-R mysq L: mysql/usr/local/mysql copy configuration file cp/usr/local/mysql/support-files/my-large.cnf/etc/my. cnf initializes the database cd/usr/local/mysqlscripts/mysql_install_db -- user = mysql to copy the file cp/usr/local/mysql/support-files/mysql required by the daemon. server/etc/rc. d/init. d/mysqld configuration daemon chkconfig-add mysqldchkconfig-level 35 mysqld on add execution file path vi ~ /. Bash_profilePATH = $ PATH: $ HOME/bin:/usr/local/mysql/bin change the configuration file vi/etc/my. edit the following information for cnf: [mysqld] # configure the connection port between the SQL node and the management node = 3306 socket =/tmp/mysql. sockndbclusterndb-connectstring = 192.168.32.133, start and close the mysql cluster www.2cto.com startup sequence: management Server-> storage node-> SQL node a, start management node rm mysql/mysql-cluster/ndb_1_config.bin.1 # is not required, if config. if ini is changed, add ndb_mgmd-f/usr/local/mysql/cluster-conf/config. inib, start the storage node ndbd-initial # (required for the first startup Add options. In addition, backup/recovery and modification of the configuration file must also be performed.) ndbd # The command c to be executed is not started for the first time, and the SQL node/etc/rc is started. d/init. d. After mysqld start or service mysqld start is started, you can use mysql-uroot-p to verify the order in which mysql service statuses are closed: SQL node-> Management node a, and SQL node/etc/rc. d/init. d/mysqld stop or service mysqld stopb, disable the management node ndb_mgm> shutdown 5. to verify the configuration correctness, you must first start the management node and then start the data node, and then start the SQL node. Otherwise, error 1 will occur. run the following command on the Management node: ndb_mgm-> show ndb_mgm> showCluster Configuration ------------------- [ndbd (NDB)] 2 node (s) id = 11 @ 202.122. 32.68 (mysql-5.5.19 ndb-7.2.4, Nodegroup: 0, Master) after starting id = 12 @ 202.38.128.153 (mysql-5.5.19 ndb-7.2.4, starting, Nodegroup: 0) is starting [ndb_mgmd (MGM)] 1 node (s) id = 1 @ 192.168.32.22 (mysql-5.5.19 ndb-7.2.4) [mysqld (API)] 3 node (s) id = 21 @ 202.122.32.68 (mysql-5.5.19 ndb-7.2.4) id = 22 @ 202.38.128.153 (mysql-5.5.19 ndb-7.2.4) id = 23 (not connected, accepting connect from any host) www.2cto.com normal status ndb_mgm> sho WCluster Configuration ------------------- [ndbd (NDB)] 2 node (s) id = 11 @ 202.122.32.68 (mysql-5.5.19 ndb-7.2.4, Nodegroup: 0, Master) id = 12 @ 202.38.128.153 (mysql-5.5.19 ndb-7.2.4, Nodegroup: 0) [ndb_mgmd (MGM)] 1 node (s) id = 1 @ 192.168.32.22 (mysql-5.5.19 ndb-7.2.4) [mysqld (API)] 3 node (s) id = 21 @ 202.122.32.68 (mysql-5.5.19 ndb-7.2.4) id = 22 @ 202.38.128.153 (mysql-5.5.19 ndb-7.2.4) id = 23 (not connected, ac Cepting connect from any host) 2. Create a database on one of the SQL nodes and add data. Wait until the startup is complete. Mysql-uroot-pcreate database ndbtest; use ndbtest; create table 't1' ('id' int (11) not null AUTO_INCREMENT, primary key ('id ')) ENGINE = ndbcluster default charset = gbk; NDB: cocould not acquire global schema lock (266) Time-out in NDB. if you add a database on a node before it is started, cannot be synchronized to other nodes.
3. On another SQL node, if the added database and data can exist, the configuration is successfully entered into the SQL node, create table 't1' (www.2cto.com 'id' int (11) not null AUTO_INCREMENT, primary key ('id') in the test Database ')) ENGINE = ndbcluster default charset = gbk switch to two data node servers ~ /Mysql/data/ndb_2_fs and ~ /Mysql/data/ndb_3_fs, or directly query the database. The data has been synchronized! Disabling the cluster service and disabling the SQL node is equivalent to stopping the mysql service. In this case, external data will not come in again. Close the management node ~ /Mysql/bin/ndb_mgm-e shutdownrm ~ /Mysql-cluster/ndb_appsconfig.bin.1 # is not required, if config. after the ini changes, the management node and data node stop the Service Notes: 1: If you find that the ndbd process of a machine is disabled, if the ndbd process of another machine is disabled, You need to modify the NoOfReplicas parameter. 2 :. /ndbd -- initial cannot be executed on all data nodes at the same time. If yes, all data will be deleted. 3: You can operate on mysqld node 4 like a non-cluster database: config. INI file. When you restart ndb_mgmd, You need to delete the ndb_assistconfig.bin.1 file under the mysql-cluster file, because it calls this file by default.
5: NDB clusters do not support automatic database discovery. This is very important. Once a world database and its tables are created on a data node, run the create database world command on each SQL node in the cluster, followed by FLUSH TABLES. In this way, the node can recognize the database and read its table definitions. (The database will also be automatically synchronized in this version of MySQL Cluster 7.1.5.) 6. If the node server is started, check ~ Related log files in the/mysql-cluster directory to obtain error information. 7. In the configuration file of the Management node, the order of Option values configured by [mysqld], [ndbd], and [ndb_mgmd] should be as follows: [mysqld] Id = 4 HostName = 192.168.208.3Id is followed by the HostName at the top. If the order is incorrect, when the SQL or data node connects to the management node, the management node cannot be correctly located on its corresponding node configuration. because the corresponding node configuration cannot be located, when no [empty node] exists, the client node starts (. /mysqld or. /ndbd) also reports: Configuration error: Error: cocould not alloc node id at 192.168.0.231 port 1186: No free www.2cto.com node id found for mysqld (API ). failed to initialize consumers 8: [empty node] indicates that node configurations without the HostName option are empty nodes. Empty nodes can be used to dynamically configure Dynamic IP nodes, generally, more than three empty nodes need to be reserved in the configuration file of the Management node, because a node needs to be connected during backup, as shown below: [mysqld] Id = 6 # ps-ef | grep mysqlroot 13882 1 0 00:00:00 pts/5/bin/sh/usr/local/mysql/bin/mysqld_safe -- datadir =/usr /local/mysql/data -- pid-file =/usr/local/mysql/data/dbs1.pidmysql 14185 13882 0 00:00:00 pts/5/usr/local/mysql/bin/mysqld -- basedir =/usr/local/mysql -- datadir =/usr/local/mysql/data -- plugin-dir =/usr/local/mysql/lib/plugin -- user = mysql -- log -error =/usr/local/mysql/data/dbs1.err -- pid-file =/usr/local/mysql/data/dbs1.pid -- socket =/tmp/mysql. sock -- Ports = 3306
Author: bigshuai

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.