中文字幕av专区_日韩电影在线播放_精品国产精品久久一区免费式_av在线免费观看网站

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

mysql-boost-5.7.18安裝方法

發布時間:2020-07-15 11:38:44 來源:網絡 閱讀:2300 作者:D十億 欄目:MySQL數據庫

  本次安裝環境為:

         系         統:centos 6  X86_X64  

         內         存:不低于4G

         mysql 版本:mysql-boost-5.7.18.tar.gz

                               本文主要講解在同主機上部署mysql多實例

門戶網站應用mysql 多實例場景

       百度搜索引擎的數據庫就是多實例,一般是從庫,列如某個部門的例子,IBM 48核CPU。內存96G,跑3-4個實例;sina 網也是用的多實例,內存48G左右。門戶網站使用多實例的目的是配硬件好的服務器,節省idc機柜的空間,同時,跑多實例讓硬件資源不浪費,針對一般的服務器最多4個實例即可,1-2兩個最合適。

        多實例可以是多個配置文件對應多實例也可以一個配置文件對應多個實例 

多實例缺點:

            1、耦合度太高,一個配置文件不好管理。工作開發和運維的統一原則;降低耦合度

          mysql 相關軟件包:    

             yum -y  install  ncurses-devel libaio-devel  cmake    

          安裝需要mysql 需要創建用戶和組

             useradd mysql -s /sbin/nologin -M

           下載mysql 5.7 安裝包

            wget https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-boost-5.7.18.tar.gz

            解壓安裝包         

              tar -zxf mysql-boost-5.7.18.tar.gz && cd mysql-5.7.18

             

cmake   \

-DCMAKE_INSTALL_PREFIX=/u01/app/mysql/db   \

-DSYSCONFDIR=/u01/app/mysql/db/etc   \

-DWITH_BOOST=./boost/boost_1_59_0 \

-DWITH_INNOBASE_STORAGE_ENGINE=1 \

-DWITH_PARTITION_STORAGE_ENGINE=1 \

-DWITH_FEDERATED_STORAGE_ENGINE=1 \

-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \

-DWITH_MYISAM_STORAGE_ENGINE=1 \

-DWITH_INNODB_MEMCACHED=1 \

-DWITH_READLINE=1   \

-DENABLED_LOCAL_INFILE=1   \

-DWITH_PARTITION_STORAGE_ENGINE=1   \

-DEXTRA_CHARSETS=all   \

-DDEFAULT_CHARSET=utf8   \

-DDEFAULT_COLLATION=utf8_general_ci  

make -j 24

make install

            #創建數據目錄

            mkdir -p /data/mysql/engine/innolog

            mkdir -p /data/mysql/data

            mkdir -p /data/mysql/engine/innodata

            mkdir -p /data/mysql/engine/undo

            mkdir -p /data/mysql/log/mysql-binlog

            mkdir -p /data/mysql/log/mysql-relaylog

            chown mysql. /data -R

            #創建mysql 配置文件目錄

            mkdir /u01/app/mysql/db/etc

            配置my.cnf

[mysqld]

#-------------------------------------basic_my.conf-------------------------------------------------------------

#5.7

#author: duxing

#modify: 20160902

#version: 0.8

#------------------basic-------------------------------#

user=mysql

basedir = /u01/app/mysql/db

datadir = /data/mysql/data

pid-file = /data/mysql/mysql.pid

socket=/data/mysql/mysql.sock

default-storage-engine = INNODB

transaction_isolation = REPEATABLE-READ

binlog_cache_size = 32M

max_binlog_size=512M

binlog_format=row

character-set-server = utf8

port=3306

server-id= 2

#sql_mode='ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'

sql_mode='STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_AUTO_VALUE_ON_ZERO,NO_ENGINE_SUBSTITUTION,ONLY_FULL_GROUP_BY'

explicit_defaults_for_timestamp = true

log-error = /data/mysql/mysql-error.log

slow_query_log

long_query_time = 10

log_warnings

#------------------basic-------------------------------#

#---------------directroy------------------------------#

innodb_log_group_home_dir=/data/mysql/engine/innolog

innodb_data_home_dir=/data/mysql/engine/innodata

innodb_data_file_path = ibdata1:500M;ibdata2:150M:autoextend

innodb_undo_directory=/data/mysql/engine/undo

log-bin =  /data/mysql/log/mysql-binlog/mysql-binlog

log-bin-index = /data/mysql/log/mysql-binlog/mysql-binlog.index

expire-logs-days=5

relay_log =  /data/mysql/log/mysql-relaylog/mysql-relay-bin

relay_log_index= /data/mysql/log/mysql-relaylog/mysql-relay-bin.index

#relay_log_info_file=/data/mysql/log/mysql-relaylog/relay-log.info

#---------------directroy------------------------------#

#----------------engine--------------------------------#

innodb_file_per_table=1

innodb_api_enable_binlog=1

innodb_buffer_pool_size=256M

innodb_flush_log_at_trx_commit = 1

innodb_log_buffer_size = 16M

innodb_log_file_size = 512M

innodb_log_files_in_group = 4

innodb_max_dirty_pages_pct = 75

innodb_lock_wait_timeout = 120

innodb_buffer_pool_instances=2

innodb_force_recovery=0 #recover

innodb_purge_threads=4 #undo purge

innodb_write_io_threads = 16

innodb_read_io_threads = 16

innodb_io_capacity=1200

innodb_old_blocks_pct=37

innodb_old_blocks_time=1000

innodb_undo_tablespaces=12

innodb_undo_logs=40

innodb_commit_concurrency = 1000 #commit/s

innodb_thread_concurrency = 1000  #use for cpu mutex

innodb_thread_sleep_delay = 200 #ms delay time

#innodb_use_native_aio=1

#----------------engine--------------------------------#

# ------------global cache -------------------------#

read_buffer_size = 32M

read_rnd_buffer_size = 128M

sort_buffer_size = 64M

join_buffer_size = 64M

query_cache_size = 128M

query_cache_limit = 4M

tmp_table_size = 128M

# ------------global cache -------------------------#

#----------------replicat-----------------------------#

#read_only=1

relay_log_purge=0

log_slave_updates=1

slave_parallel_workers=4

log_bin_trust_function_creators=1

binlog_checksum = CRC32

slave_allow_batching = 1

master_verify_checksum = 1

slave_sql_verify_checksum = 1

binlog_rows_query_log_events = 1

gtid-mode=on

enforce-gtid-consistency=1

sync-master-info=1

relay_log_purge = 1                   #relaylog的自動修復

relay_log_recovery = 1

master_info_repository = TABLE

relay_log_info_repository = TABLE

#set global rpl_semi_sync_master_enabled = 1

#set global rpl_semi_sync_slave_enabled =1

#rpl_semi_sync_master_timeout=200

#----------------replicat-----------------------------#

#-----------------thread------------------------------#

table_open_cache         = 2048   #reduce open descriptor

thread_stack             = 256K   # *thead_num < useable mem

thread_cache_size        = 128    #reuse thread in mem

#-----------------thread------------------------------#

#----------------network-----------------------------#

back_log                = 512

#skip-networking

#skip-grant-tables

skip-name-resolve

max_connections         = 3000

max_connect_errors      = 30

table_open_cache        = 4096

max_allowed_packet      = 64M

max_heap_table_size     = 512M

#----------------network-----------------------------#

#-----------------------timeout------------------------#

connect-timeout          = 10

wait-timeout             = 8000

interactive-timeout      = 8000

slave-net-timeout        = 60

net_read_timeout         = 30

net_write_timeout        = 60

net_retry_count          = 10

net_buffer_length        = 16384

#-----------------------timeout------------------------#

[mysql]

auto-rehash

[client]

socket=/data/mysql/mysql.sock

port=3306

                刪除 /etc/my.cnf

                /u01/app/mysql/db/etc

                初始化之前需要查看error 日志

                cat /data/mysql/mysql-error.log

                cd /u01/app/mysql/db

                ./bin/mysqld --initialize --basedir=/u01/app/mysql/db --datadir=/data/mysql/data  --user=mysql
                
# --initialize-insecure option 使用這個初始化數據庫之后不再需要登錄后進行alter user

                #cat /data/mysql/mysql-error.log

                

                /u01/app/mysql/db/bin/mysqld_safe --skip-grant-tables &

                update mysql.user set authentication_string=password('123.com') where user='root' and Host = 'localhost';

                #啟動mysql 服務

            /u01/app/mysql/db/support-files/mysql.server restart

                ##需要重新更改密碼否則無法正常使用庫

            alter user 'root'@'localhost' identified by '123.com';

            #設置開機自啟動

            cp /u01/app/mysql/db/support-files/mysql.server /etc/init.d/mysql.server-5.7

            chmod +x  /etc/init.d/mysql.server-5.7

            chkconfig --addmysql.server-5.7

            #設置環境變量

            vim ~/.bashrc

            #set mysql

            NHOME=/u01/app/mysql/db

            PATH=$PATH:$NHOME/bin

            source ~/.bashrc

mysql 多實例可以寫兩個不同的配置文件與不同的端口 初始化庫時候直接更改即可




    

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

井研县| 通州区| 车致| 商都县| 方山县| 曲松县| 邹城市| 游戏| 武城县| 石渠县| 武安市| 黄冈市| 华宁县| 弥渡县| 吉隆县| 金平| 体育| 辽宁省| 杨浦区| 南城县| 景德镇市| 江西省| 常熟市| 新宾| 乌苏市| 孝昌县| 白山市| 岗巴县| 成武县| 馆陶县| 西峡县| 晋城| 镇平县| 奈曼旗| 栾川县| 永靖县| 丹江口市| 库尔勒市| 开封县| 井研县| 鄯善县|