centos 7 部署AliSQL

[root@walletmdb ~]# cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.1.201   walletmdb

[root@walletmdb ~]# useradd mysql
[root@walletmdb ~]# id mysql
uid=500(mysql) gid=500(mysql) groups=500(mysql)

[root@walletmdb ~]# cat >> /etc/security/limits.conf <<EOF
mysql            soft    nproc          2048
mysql            hard    nproc          16384
mysql            soft    nofile         2048
mysql            hard    nofile         65536
EOF

[root@walletmdb ~]# rpm -ivh epel-release-latest-7.noarch.rpm 
[root@walletmdb ~]# yum install -y cmake libaio-devel ncurses-devel

[root@walletmdb ~]# tar zxvf AliSQL-AliSQL-5.6.32-9.tar.gz
[root@awalletmdb ~]# cd AliSQL-AliSQL-5.6.32-9
[root@walletmdb AliSQL-AliSQL-5.6.32-9]# cmake . \
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
-DMYSQL_DATADIR=/usr/local/mysql/data \
-DSYSCONFDIR=/etc \
-DMYSQL_UNIX_ADDR=/tmp/mysql.sock \
-DWITH_PARTITION_STORAGE_ENGINE=1 \
-DWITH_PERFSCHEMA_STORAGE_ENGINE=1 \
-DWITHOUT_TOKUDB_STORAGE_ENGINE=1 \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci

[root@walletmdb AliSQL-AliSQL-5.6.32-9]# make -j4
[root@walletmdb AliSQL-AliSQL-5.6.32-9]# make install

[root@walletmdb AliSQL-AliSQL-5.6.32-9]# cd support-files/
[root@walletmdb support-files]# cp mysql.server /etc/init.d/mysqld
[root@walletmdb support-files]# chmod a+x /etc/init.d/mysqld

[root@walletmdb ~]# vim /etc/my.cnf 
[mysqld]
port = 3306
user = mysql
basedir = /usr/local/mysql
datadir = /usr/local/mysql/data
tmpdir = /usr/local/mysql/temp
socket = /tmp/mysql.sock
character-set-server = utf8  
sql_mode = NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
explicit_defaults_for_timestamp
open-files-limit = 65535
max_allowed_packet = 16M
max_connections = 500
max_connect_errors = 10000
read_buffer_size = 1M
read_rnd_buffer_size = 1M
sort_buffer_size = 1M
join_buffer_size = 1M
tmp_table_size = 256M
max_heap_table_size = 256M
log_bin = mysql-bin
binlog_format = row
binlog_cache_size = 8M
max_binlog_cache_size = 256M
max_binlog_size = 512M
expire_logs_days = 7
slow_query_log = 1
long_query_time = 5
query_cache_type = 0
query_cache_size = 0
key_buffer_size = 256M
default_storage_engine = InnoDB
transaction_isolation = REPEATABLE READ
innodb_data_home_dir = /usr/local/mysql/data
innodb_log_group_home_dir = /usr/local/mysql/data
innodb_buffer_pool_size = 8G
innodb_buffer_pool_instances = 8
innodb_log_file_size = 256M
innodb_log_files_in_group = 3
innodb_log_buffer_size = 16M
innodb_undo_logs= 128
innodb_undo_tablespaces = 3
innodb_file_format = Barracuda
innodb_file_format_max = Barracuda
innodb_data_file_path = ibdata1:1024M:autoextend

[mysql]
no-auto-rehash
default-character-set=utf8
socket = /tmp/mysql.sock
prompt = "\\u@\\h : \\d \\R:\\m:\\s> "

[client]
default-character-set=utf8
socket = /tmp/mysql.sock

[root@walletmdb ~]# cd /usr/local/mysql
[root@walletmdb mysql]# scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data

[root@walletmdb ~]# vim /etc/profile
PATH=$PATH:/usr/local/mysql/bin
[root@walletmdb ~]# source /etc/profile

[root@walletmdb ~]# echo "/usr/local/mysql/lib" > /etc/ld.so.conf.d/mysql.conf
[root@walletmdb ~]# ldconfig

[root@walletmdb ~]# systemctl enable mysqld
[root@walletmdb ~]# systemctl start mysqld
[root@walletmdb ~]# systemctl status mysqld
[root@walletmdb ~]# systemctl status mysqld
● mysqld.service - LSB: start and stop MySQL
   Loaded: loaded (/etc/rc.d/init.d/mysqld; bad; vendor preset: disabled)
   Active: active (running) since Mon 2018-12-03 18:28:10 CST; 8s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 5293 ExecStop=/etc/rc.d/init.d/mysqld stop (code=exited, status=0/SUCCESS)
  Process: 5324 ExecStart=/etc/rc.d/init.d/mysqld start (code=exited, status=0/SUCCESS)
   CGroup: /system.slice/mysqld.service
           ├─5335 /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/usr/local/mysql/data --pid-file=/usr/local/mysql/data/gscf09....
           └─5949 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --plugin-dir=/usr/local/my...

Dec 03 18:28:07 gscf09 systemd[1]: Starting LSB: start and stop MySQL...
Dec 03 18:28:10 gscf09 mysqld[5324]: Starting MySQL... SUCCESS!
Dec 03 18:28:10 gscf09 systemd[1]: Started LSB: start and stop MySQL.

[root@awalletmdb ~]# yum install -y net-tools
[root@awalletmdb ~]# netstat -tupln |grep mysqld

[root@awalletmdb ~]# mysql_secure_installation


猜你喜欢

转载自blog.51cto.com/13598811/2325175