Virtual machine ubuntu deployment of multi-point mysql-cluster7.3.2 server _ MySQL

Source: Internet
Author: User
Tags mysql commands
Ubuntu virtual machine deployment of multi-point mysql-cluster7.3.2 server Ubuntu

BitsCN.com

Deploy multi-point mysql-cluster7.3.2 server in ubuntu under virtual machine

Deployment environment:

System: ubuntu-12.04.2 LTS-server-i386.iso

Cluster: mysql-cluster-gpl-7.3.2-linux-glibc23-i686.tar.gz

Note:

1. it is best not to install Mysql-server (the cluster here is a binary version)

2. chkconfig needs to be installed separately and libaio1 must be installed separately to solve the problem that libaio. so.1 cannot be found. this component must be installed when mysql is installed.

Today, we finally solved the problem of multiple points. this is a verified version.

Mgm node: 192.168.131.11

SQL Data node: 192.168.131.12

SQL Data node: 192.168.131.13

(1) install management nodes

1. decompress the file

Sudo tar-zvxf mysql-cluster-gpl-7.3.2-linux-glibc23-i686.tar.gz

Sudo music mysql-cluster-gpl-7.3.2-linux-glibc23-i686 mysqlc

2. create an installation directory

Sudo mkdir-p/home/lwprain/ndbdata

Sudo cd mysqlc

Sudo cp bin/ndb_mgmd/usr/local/bin

Sudo cp bin/ndb_mgm/usr/local/bin

3. configure the log file storage directory

Sudo mkdir/var/lib/mysql-cluster

4. create a configuration file directory and file

Sudo touch config. ini

Sudo nano config. ini

========================= Configuration file content ==========================

[Ndbd default]

NoOfReplicas = 2 # Number of duplicate members

DataMemory = 80 M # memory available for data storage

IndexMemory = 18 M # memory available for index storage

[Ndb_mgmd] # define the IP address or host name of the management node

Nodeid = 1

HostName = 192.168.131.11

DataDir =/var/lib/mysql-cluster

[Ndbd] # define data nodes

Nodeid = 11

HostName = 192.168.131.12

DataDir =/home/lwprain/ndbdata

[Ndbd] # define data nodes

Nodeid = 12

HostName = 192.168.131.13

DataDir =/home/lwprain/ndbdata

[Ndbd]

[Mysqld] # define an SQL node

Nodeid = 21

HostName = 192.168.131.12

[Ndbd]

[Mysqld] # define an SQL node

Nodeid = 22

HostName = 192.168.131.13

[Mysqld]

[Mysqld]

========================================================== ================

(2) install the SQL Data node

Decompress the file

Sudo tar-zvxf mysql-cluster-gpl-7.3.2-linux-glibc23-i686.tar.gz

Sudo music mysql-cluster-gpl-7.3.2-linux-glibc23-i686 mysqlc

Create installation directory

Mkdir-p/home/lwprain/ndbdata

Copy the execution file

Cp mysqlc/bin/ndbd/usr/local/bin

Add a mysql User

Groupadd mysql

Useradd-g mysql

Add permission

Chown-R mysql: mysql/home/lwprain/mysqlc

Copy configuration file

Cp/home/lwprain/mysqlc/support-files/my-default.cnf/etc/my. cnf

Initialize database

Cd/home/lwprain/mysqlc

Scripts/mysql_install_db -- user = mysql

Copy the files required by the Daemon

Cp/home/lwprain/mysqlc/support-files/mysql. server/etc/init. d/mysqld

Change configuration file

Sudo nano/etc/my. cnf # Copy from mysqlc to/etc

Edit the following information:

[Mysqld] # configure the connection between an SQL node and a management node

Port = 3306

Socket =/tmp/mysql. sock

Ndbcluster

Ndb-connectstring = 192.168.131.11

[Mysql_cluster] # configure a data node connection management node

Ndb-connectstring = 192.168.131.11

(3) starting and disabling a Cluster

Start in sequence: manage nodes ---> data nodes ---> SQL nodes note: show in ndb_mgm is displayed correctly only after all the nodes are started (this is a key factor that is considered unsuccessful, I 've been on a detour)

1. start the management node

Cd/usr/local/bin/

Ndb_mgmd-f/home/lwprain/config. ini

Ndb_mgm (view node connection information)

2. start the data node

/Usr/local/bin/ndbd -- initial (this command is used for the first startup)

/Usr/local/bin/ndbd (use this command later)

3. start the SQL node

/Home/lwprain/mysqlc/bin/mysqld_safe -- user = mysql &

After setting the path, you can flexibly execute mysql commands.

Log on to your user (non-root) and enter:

$ Sudo nano ~ /. Profile

You can add the PATH at the end of this file as follows:

Export PATH = "PATH:/home/lwprain/mysqlc/bin /"

Save the file, log out, and log on again. The variable takes effect.

The variables added in this method are only valid for the current user.

Then log on to mysql on a server

Mysql-uroot

Show engines;

Check whether ndbcluster is successfully installed.

Create databases and tables

Create database test;

Create table tt (id int (10) engine = ndbcluster;

Insert into tt (1 );

Then go to another server to view

Check whether the database is synchronized

BitsCN.com
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.