简介
[说明本次部署的内容,目的等等]
本部署文档的目的是如何在ubuntu server上进行mysql的群集部署。
前期准备在进行本文档操作前,,需要完成如下前期步骤:
1. 安装3台ubuntu server服务器;
server1: ndbd 192.168.68.5
server2: ndbd 192.168.68.6
server3: mysqld –ndb-cluster 192.168.68.8
ndbd(192.168.68.5\192.168.68.6): 数据库节点,存放数据。
mysqld –ndb-cluster(192.168.68.8): mysql服务器节点,管理节点,管理群集。
注:
本实验在ubuntu server (8.04)实现
管理节点:server3(192.168.68.8)存储节点:server1(192.168.68.5),server2(192.168.68.6)
2. 3台server均安装mysql - server数据库。
部署概要1. 安装ubuntu服务器(本实验使用为8.04);
2. 安装mysql – server数据库;
3. 这三台服务器上配置my.cnf;
4. 管理节点(192.168.68.8)上配置ndb_mgmd.cnf;
5. 管理节点服务器上启动mysql-ndb-mgm;
6. 存储节点上(192.168.68.5\6)启动mysql-ndb;
7. 3台服务器分别启动mysql-ndb服务;
8. 测试管理节点。
部署步骤安装ubuntu服务器1. 安装ubuntu服务器,安装过程中安装msyql(也可单独安装)、openssh服务。
群集配置1. 在三台服务器上配置my.cnf,三台服务器都要配置。
vim /etc/mysql/my.cnf
—————————————–my.cnf开始——————————————–
ubuntu@ubuntu:~$ cat /etc/mysql/my.cnf
#
# the mysql database server configuration file.
#
# you can copy this to one of:
# - “/etc/mysql/my.cnf” to set global options,
# - “~/.my.cnf” to set user-specific options.
#
# one can use all long options that the program supports.
# run program with –help to get a list of available options and with
# –print-defaults to see which it would actually understand and use.
#
# for explanations see
#
# this will be passed to all mysql clients
# it has been reported that passwords should be enclosed with ticks/quotes
# escpecially if they contain “#” chars…
# remember to edit /etc/mysql/debian.cnf when changing the socket location.
[client]
port = 3306
socket = /var/run/mysqld/mysqld.sock
# here is entries for some specific programs
# the following values assume you have at least 32m ram
# this was formally known as [safe_mysqld]. both versions are currently parsed.
[mysqld_safe]
socket = /var/run/mysqld/mysqld.sock
nice = 0
[mysqld]
#
# * basic settings
#
#
# * important
# if you make changes to these settings and your system uses apparmor, you may
# also need to also adjust /etc/apparmor.d/usr.sbin.mysqld.
#
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
language = /usr/share/mysql/english
skip-external-locking
#
# instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
# bind-address = 127.0.0.1
#
# * fine tuning
#
key_buffer = 16m
max_allowed_packet = 16m
thread_stack = 128k
thread_cache_size = 8
#max_connections = 100
#table_cache = 64
#thread_concurrency = 10
#
# * query cache configuration
#
query_cache_limit = 1m
query_cache_size = 16m
#
# * logging and replication
#
# both location gets rotated by the cronjob.
# be aware that this log type is a performance killer.
#log = /var/log/mysql/mysql.log
#
# error logging goes to syslog. this is a debian improvement
#
# here you can see queries with especially long duration
#log_slow_queries = /var/log/mysql/mysql-slow.log
#long_query_time = 2
#log-queries-not-using-indexes
#
# the following can be used as easy to replay backup logs or for replication.
# note: if you are setting up a replication slave, see readme.debian about
# other settings you may need to change.
#server-id = 1
#log_bin = /var/log/mysql/mysql-bin.log
expire_logs_days = 10
max_binlog_size = 100m
#binlog_do_db = include_database_name
#binlog_ignore_db = include_database_name
#
# * berkeleydb
#
# using berkeleydb is now discouraged as its support will cease in 5.1.12.
skip-bdb
#
# * myisam
#
# myisam is enabled by default with a 10mb datafile in /var/lib/mysql/.
# read the manual for more myisam related options. there are many!
# you might want to disable myisam to shrink the mysqld process by circa 100mb.
#skip-innodb
#
# * security features
#
# read the manual, too, if you want chroot!
# chroot = /var/lib/mysql/
#
# for generating ssl certificates i recommend the openssl gui “tinyca”.
#
# ssl-ca=/etc/mysql/cacert.pem
# ssl-cert=/etc/mysql/server-cert.pem
# ssl-key=/etc/mysql/server-key.pem
#如下是管理节点的ip地址
ndbcluster
ndb-connectstring=192.168.68.8
[mysqldump]
quick
quote-names
max_allowed_packet = 16m
[mysql]
#no-auto-rehash # faster start of mysql but no tab completition
[isamchk]
key_buffer = 16m
#
# * ndb cluster
#
# see /usr/share/doc/mysql-server-*/readme.debian for more information.
#
# the following configuration is read by the ndb data nodes (ndbd processes)
# not from the ndb management nodes (ndb_mgmd processes).
#
[mysql_cluster]
ndb-connectstring=192.168.68.8
#
# * important: additional settings that can override those from this file!
# the files must end with ‘.cnf’, otherwise they’ll be ignored.
#
!includedir /etc/mysql/conf.d/
ubuntu@ubuntu:~$
提示