corosync+pacemaker+drbd+mysql-ly36843运维
#安装基础软件包# yum -y install make gcc-c++ cmake bison-develncurses-devel
#创建用户
# groupadd mysql
# useradd -g mysql mysql -s /sbin/nologin
#创建用来存放Mysql数据的目录
# drbdadm down web
# mkdir /data
# mount /dev/sdb1 /data/
# df -h
Filesystem SizeUsed Avail Use% Mounted on
/dev/sda3 18G1.6G 16G10% /
tmpfs 495M 37M458M 8% /dev/shm
/dev/sda1 194M 28M156M16% /boot
/dev/sdb1 48G210M 45G 1% /data
# ll /data/mysql/data/
total 28704
-rw-rw---- 1 mysql mysql 18874368 Jun 12 09:55 ibdata1
-rw-rw---- 1 mysql mysql5242880 Jun 12 09:55 ib_logfile0
-rw-rw---- 1 mysql mysql5242880 Jun 12 09:55 ib_logfile1
drwx------ 2 mysql root 4096 Jun 11 17:30 mysql
-rw-rw---- 1 mysql mysql 192 Jun 12 09:56 mysql-bin.000001
-rw-rw---- 1 mysql mysql 19 Jun 12 09:55 mysql-bin.index
-rw-r----- 1 mysql root 1798 Jun 12 09:55 node1.test.com.err
-rw-rw---- 1 mysql mysql 5 Jun 12 09:55 node1.test.com.pid
drwx------ 2 mysql mysql 4096 Jun 11 17:30 performance_schema
drwx------ 2 mysql root 4096 Jun 11 17:30 test
drwx------ 2 mysql mysql 4096 Jun 12 09:56 weyee
#安装mysql
# tar xf mysql-5.5.37.tar.gz
# cd mysql-5.5.37
# cmake \
> -DCMAKE_INSTALL_PREFIX=/usr/local/mysql-5.5.37 \
> -DMYSQL_DATADIR=/data/mysql/data \
> -DSYSCONFDIR=/etc \
> -DWITH_MYISAM_STORAGE_ENGINE=1 \
> -DWITH_INNOBASE_STORAGE_ENGINE=1 \
> -DWITH_MEMORY_STORAGE_ENGINE=1 \
> -DWITH_READLINE=1 \
> -DMYSQL_UNIX_ADDR=/var/lib/mysql/mysql.sock \
> -DMYSQL_TCP_PORT=3306 \
> -DENABLED_LOCAL_INFILE=1 \
> -DWITH_PARTITION_STORAGE_ENGINE=1 \
> -DEXTRA_CHARSETS=all \
> -DDEFAULT_CHARSET=utf8 \
> -DDEFAULT_COLLATION=utf8_general_ci
# make && make install
#从node1上将启动脚本和my.cnf文件复制过来
# scp /etc/init.d/mysqld node2:/etc/init.d/
mysqld 100% 11KB10.7KB/s 00:00
# scp /etc/my.cnf node2:/etc
my.cnf 100% 4675 4.6KB/s 00:00
#配置软链接
# ln -s /usr/local/mysql-5.5.37/ /usr/local/mysql
# ln -s /usr/local/mysql-5.5.37/bin/* /usr/bin/
#正常情况下我们现在能够启动mysql,而且能看到在node1上创建的weyee数据库
#启动数据库
# /etc/init.d/mysqld start
Starting MySQL.. SUCCESS!
# netstat -anpt |grep 3306
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 14324/mysqld
#查看数据库结果
# mysql
Welcome to the MySQL monitor.Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.5.37-log Source distribution
Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| test |
| weyee | #在node1上创建的数据库weyee已显示出来
+--------------------+
5 rows in set (0.04 sec)
页:
[1]