In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article will explain in detail how to install mysql cluster on server. The editor thinks it is very practical, so I share it with you for reference. I hope you can get something after reading this article.
Environment:
An OS
Redhat linux 5.1
RAM 2G hard disk space: 2G
First create mysql groups and mysql users:
Groupadd mysql
Useradd-g mysql mysql
Download software: http://www.mysql.com/downloads/cluster/
[@ more@]
Installation:
[user1@ws2 ~] $tar xvf Downloads/mysql-cluster-gpl-7.1.3-linux-x86_64-glibc23.tar.gz
[user1@ws2] $ln-s mysql-cluster-gpl-7.1.3-linux-x86_64-glibc23 mysqlc
Put ~ / mysqlc/bin under your path environment variable.
Configuration:
[user1@ws2 ~] $mkdir my_cluster my_cluster/ndb_data my_cluster/mysqld_data my_cluster/conf
Under the conf directory you just created, create two files, my.cnf and config.ini, with the following contents:
My.cnf:
[mysqld]
Ndbcluster
Datadir=/home/user1/my_cluster/mysqld_data
Basedir=/home/user1/mysqlc
Port=5000
Config.ini:
[ndb_mgmd]
Hostname=localhost
Datadir=/home/user1/my_cluster/ndb_data
Id=1
[ndbd default]
Noofreplicas=2
Datadir=/home/user1/my_cluster/ndb_data
[ndbd]
Hostname=localhost
Id=3
[ndbd]
Hostname=localhost
Id=4
[mysqld]
Id=50
Initialization
[user1@ws2 ~] $cd mysqlc
[user1@ws2 mysqlc] $scripts/mysql_install_db-- no-defaults-- datadir=$HOME/my_cluster/mysqld_data/
Start:
[user1@ws2 mysqlc] $cd. / my_cluster/
[user1@ws2 my_cluster] $HOME/mysqlc/bin/ndb_mgmd-f conf/config.ini-- initial-
Configdir=$HOME/my_cluster/conf/
[user1@ws2 my_cluster] $$HOME/mysqlc/bin/ndbd-c localhost:1186
[user1@ws2 my_cluster] $$HOME/mysqlc/bin/ndbd-c localhost:1186
View the status of each node and data node through mysql's manager:
[user1@ws2 my_cluster] $$HOME/mysqlc/bin/ndb_mgm-e show
Connected to Management Server at: localhost:1186
Cluster Configuration
-
[ndbd (NDB)] 2 node (s)
Id=3 @ 127.0.0.1 (mysql-5.1.44 ndb-7.1.3, Nodegroup: 0, Master)
Id=4 @ 127.0.0.1 (mysql-5.1.44 ndb-7.1.3, Nodegroup: 0)
[ndb_mgmd (MGM)] 1 node (s)
Id=1 @ 127.0.0.1 (mysql-5.1.44 ndb-7.1.3)
[mysqld (API)] 1 node (s)
Id=50 (not connected, accepting connect from any host)
Start the mysql database:
[user1@ws2 my_cluster] $$HOME/mysqlc/bin/mysqld-- defaults-file=conf/my.cnf &
Start the mysql database securely:
Mysqld_safe-defaults-file=conf/my.cnf-ledir=/mysql/mysqlc/bin
Test:
[user1@ws2 my_cluster] $HOME/mysqlc/bin/mysql-h 127.0.0.1-P 5000-u root
Mysql > create database clusterdb;use clusterdb
Mysql > create table simples (id int not null primary key) engine=ndb
Mysql > insert into simples values (1), (2), (3), (4)
Mysql > select * from simples
+-- +
| | id |
+-- +
| | 3 |
| | 1 |
| | 2 |
| | 4 |
+-- +
Secure shutdown:
[user1@ws2 my_cluster] $HOME/mysqlc/bin/mysqladmin-u root-h 127.0.0.1-P 5000 shutdown
[user1@ws2 my_cluster] $$HOME/mysqlc/bin/ndb_mgm-e shutdown
Problem record:
After installation, you may not be able to access MySQL in other IP breakers. When you visit, you will report:
[Warning] IP address' 10.11.32.185' could not be resolved: getnameinfo () returned error (code:-3).
This is because MySQL does DNS parsing for external connections
Add: in the conf/my.cnf file:
[mysqld]
Skip-name-resolve
# prohibit MySQL from parsing DNS for external connections. Use this option to eliminate the time for MySQL to parse DNS. But you need to note.
If this option is turned on, all remote host connection authorizations must use IP address, otherwise MySQL will not be able to handle connection # requests properly!
# 1: remove the skip-name-resolve from the mysql startup parameters, and then use both the ip address and the host name for the jdbc connection string.
# 2: if you keep the startup parameter skip-name-resolve, you can only use IP address to connect to the database in the jdbc connection string.
Add the above parameters, and then grant permissions to the user:
Grant all privileges on *. * to root@ "%" identified by 'qinqiang' with grant option
Logging in again in this way will be OK.
This is the end of the article on "how to install mysql cluster on server". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.