美文网首页centos应用服务配置
centos7,alisql5.6.32的安装

centos7,alisql5.6.32的安装

作者: Hellooooooworld | 来源:发表于2017-06-25 21:11 被阅读56次

    站在巨人的肩膀上~

    part1 centos环境的确定和从u盘中拷贝alisql.zip包

    在root下输入hostnamectl 得到信息

    [root@localhost src]# hostnamectl 
       Static hostname: localhost.localdomain
             Icon name: computer-desktop
               Chassis: desktop
            Machine ID: a04e0f548d4648df917d0754ce5c5e24
               Boot ID: 18984f0a5d53487a87fa266534ec395b
      Operating System: CentOS Linux 7 (Core)
           CPE OS Name: cpe:/o:centos:centos:7
                Kernel: Linux 3.10.0-514.el7.x86_64
          Architecture: x86-64
    

    U盘挂挂载教程:

    [root@localhost src]# fdisk -l 
       Device Boot      Start         End      Blocks   Id  System
    /dev/sdc1   *          48    31129599    15564776    c  W95 FAT32 (LBA)
    

    输入该命令即可得到硬盘信息和U盘信息。

    [root@localhost src]# mkdir /mnt/usb
    

    新建一个文件夹专门用来挂载U盘。

    [root@localhost ~]# mount -t vfat /dev/sdc1 /mnt/usb/
    

    根据上的U盘信息,将U盘挂在在/mnt/usb/下。挂载成功后进入/mnt/usb即可复制文件。
    复制完之后,我们需要卸载U盘。

    [root@localhost src]#  umount -l /mnt/usb/
    

    part2AliSQL的依赖包准备

    2.0环境以及AliSQL版本

    OS: CentOS Linux 7 (Core) Linux 3.10.0-123.el7.x86_64
    AliSQL: 5.6.32

    2.1准备工作

    检查cmake 和 gcc 版本

    [root@localhost ~]# cmake --version
    cmake version 2.8.12.2
    cmake: 2.8.12.2
    [root@localhost ~]# gcc --version
    gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-11)
    gcc: 4.8.2
    

    清理默认mariadb

    [root@localhost ~]# rpm -ev mariadb-libs-5.5.35-3.el7.x86_64 --nodeps
    

    依赖包下载

    [root@localhost ~]# yum -y install ncurses-devel zlib zlib-devel cmake bison perl-Data-Dumper
    

    关闭hugepage

    [root@localhost ~]#echo never > /sys/kernel/mm/transparent_hugepage/enabled
    [root@localhost ~]#echo "echo never > /sys/kernel/mm/transparent_hugepage/enabled" >> /etc/rc.local
    [root@localhost ~]#chmod +x /etc/rc.d/rc.local
    [root@localhost ~]#systemctl disable tuned
    

    part.3安装步骤

    1. 复制AliSQL-5.6.32.zip
    [root@localhost ~]# cd /usr/local/src
    [root@localhost ~]# cp AliSQL-5.6.32.zip /usr/local
    [root@localhost ~]# cd /usr/local
    
    1. 解压
    [root@localhost local]# unzip AliSQL-5.6.32.zip
    

    如果没有安装unzip

    [root@localhost ~]# yum -y install unzip
    
    1. 重命名
    [root@localhost local]# mv alibaba-AliSQL-cc84a09 mysql
    [root@localhost local]# cd mysql
    
    1. 创建mysql用户组及用户
    [root@localhost mysql]# groupadd mysql
    [root@localhost mysql]# useradd -g mysql mysql
    
    1. cmake参数
    [root@localhost mysql]# cmake                               \
     -DCMAKE_BUILD_TYPE="Release"         \
     -DCMAKE_INSTALL_PREFIX="/usr/local/mysql" \
     -DWITH_EMBEDDED_SERVER=0             \
     -DWITH_EXTRA_CHARSETS=all            \
     -DWITH_MYISAM_STORAGE_ENGINE=1       \
     -DWITH_INNOBASE_STORAGE_ENGINE=1     \
     -DWITH_PARTITION_STORAGE_ENGINE=1    \
     -DWITH_CSV_STORAGE_ENGINE=1          \
     -DWITH_ARCHIVE_STORAGE_ENGINE=1      \
     -DWITH_BLACKHOLE_STORAGE_ENGINE=1    \
     -DWITH_FEDERATED_STORAGE_ENGINE=1    \
     -DWITH_PERFSCHEMA_STORAGE_ENGINE=1   \
     -DWITH_TOKUDB_STORAGE_ENGINE=1
    
    1. 编译安装
    [root@localhost mysql]# make -j4 && make install
    
    1. 复制mysql配置文件
    [root@localhost mysql]# cp /usr/local/mysql/support-files/my-default.cnf /etc/my.cnf
    
    1. 以4核8G内存虚机为例编辑mysql配置文件为
    [mysqld]
    socket = /usr/local/mysql/data/tmp/mysql.sock
    datadir = /usr/local/mysql/data
    tmpdir = /usr/local/mysql/tmp
    port = 3306
    back_log = 3000
    character_set_server = utf8
    max_connect_errors = 100
    max_connections = 4050
    max_user_connections = 4050
    max_heap_table_size = 64M
    max_allowed_packet = 1024M
    max_binlog_size = 500M
    thread_stack = 256K
    interactive_timeout = 7200
    wait_timeout = 86400
    sort_buffer_size = 848KB
    read_buffer_size = 848KB
    read_rnd_buffer_size = 432KB
    join_buffer_size = 432KB
    net_buffer_length = 16K
    thread_cache_size = 100
    ft_min_word_len = 4
    transaction_isolation = READ-COMMITTED
    tmp_table_size = 2097152
    table_open_cache = 2000
    skip_name_resolve
    core-file
    lower_case_table_names = 1
    log_bin_trust_function_creators = 1
    log-bin = /usr/local/mysql/data/mysql/mysql-bin.log
    log-bin-index = /usr/local/mysql/data/mysql/master-log-bin.index
    log-error = /usr/local/mysql/data/mysql/master-error.log
    relay-log = /usr/local/mysql/data/mysql/slave-relay.log
    relay-log-info-file = /usr/local/mysql/data/mysql/slave-relay-log.info
    relay-log-index = /usr/local/mysql/data/mysql/slave-relay-log.index
    master-info-file = /usr/local/mysql/data/mysql/master.info
    log-slave-updates = 1
    binlog_cache_size = 2048KB
    sync_binlog = 1
    log_warnings
    slow_query_log_file = /usr/local/mysql/data/mysql/slow_query.log
    slow_query_log = 1
    log_output = TABLE
    long_query_time = 1
    binlog_format = ROW
    server_id = 1482959851
    auto_increment_increment = 1
    auto_increment_offset = 1
    slave_net_timeout = 60
    key_buffer_size = 16M
    bulk_insert_buffer_size = 4M
    myisam_sort_buffer_size = 262144
    myisam_max_sort_file_size = 2048K
    myisam_repair_threads = 1
    myisam_recover_options = FORCE
    innodb_data_home_dir = /usr/local/mysql/data/mysql
    innodb_log_group_home_dir = /usr/local/mysql/data/mysql
    innodb_additional_mem_pool_size = 2097152
    innodb_buffer_pool_size = 13108M
    innodb_data_file_path = ibdata1:200M:autoextend
    innodb_file_per_table
    innodb_file_io_threads = 4
    innodb_flush_log_at_trx_commit = 1
    innodb_log_buffer_size = 8M
    innodb_log_file_size = 1500M
    innodb_log_files_in_group = 2
    innodb_max_dirty_pages_pct = 75
    innodb_flush_method = O_DIRECT
    innodb_lock_wait_timeout = 50
    innodb_doublewrite = 1
    innodb_rollback_on_timeout = OFF
    innodb_autoinc_lock_mode = 1
    innodb_read_io_threads = 4
    innodb_write_io_threads = 4
    innodb_io_capacity = 2000
    innodb_purge_threads = 1
    master_info_repository = TABLE
    relay_log_info_repository = TABLE
    query_cache_type = 0
    concurrent_insert = 1
    query_cache_limit = 1048576
    query_cache_min_res_unit = 1K
    log-slow-admin-statements
    innodb_stats_on_metadata = OFF
    innodb_file_format = Barracuda
    innodb_read_ahead = 0
    innodb_thread_concurrency = 0
    innodb_sync_spin_loops = 100
    innodb_spin_wait_delay = 30
    default_storage_engine = InnoDB
    innodb_stats_sample_pages = 8
    open_files_limit = 65535
    gtid_mode = ON
    loose_rds-anonymous-in-gtid-out-enable = 1
    enforce-gtid-consistency = 1
    loose_opt_rds_enable_show_slave_lag = on
    loose_performance_schema = off
    loose_innodb_rds_buffer_pool_file_del = ON
    loose_binlog_order_commits = OFF
    innodb_ft_max_token_size = 84
    loose_opt_rds_enable_set_default_engine = OFF
    log_bin_use_v1_row_events = 1
    loose_innodb_rds_autoinc_persistent_interval = 1
    delay_key_write = ON
    key_cache_division_limit = 100
    innodb_old_blocks_pct = 37
    loose_rds_gtid_precommit = ON
    loose_implicit_primary_key = 1
    ft_query_expansion_limit = 20
    loose_rds_binlog_group_commit_sync_no_delay_count = 0
    loose_tokudb_checkpointing_period = 60
    loose_thread_pool_stall_limit = 30
    loose_innodb_log_compressed_pages = OFF
    init_connect = ''
    innodb_print_all_deadlocks = OFF
    delayed_insert_timeout = 300
    loose_thread_pool_oversubscribe = 10
    loose_max_statement_time = 0
    loose_tokudb_commit_sync = ON
    binlog_stmt_cache_size = 32768
    net_retry_count = 10
    binlog_checksum = CRC32
    low_priority_updates = 0
    loose_tokudb_support_xa = ON
    loose_rds_slave_minor_log = OFF
    autocommit = 1
    loose_rds_set_connection_id_enabled = ON
    key_cache_age_threshold = 300
    innodb_concurrency_tickets = 5000
    loose_innodb_rds_log_checksum_algorithm = INNODB
    table_definition_cache = 512
    loose_rds_binlog_group_commit_sync_delay = 0
    loose_rds_check_core_file_enabled = ON
    loose_tokudb_rpl_lookup_rows = OFF
    innodb_use_native_aio = 0
    net_write_timeout = 60
    loose_rds_threads_running_high_watermark = 50000
    innodb_table_locks = ON
    query_alloc_block_size = 8192
    loose_tokudb_fs_reserve_percent = 5
    max_prepared_stmt_count = 16382
    loose_rds_enable_skip_counter = ON
    innodb_thread_sleep_delay = 10000
    net_read_timeout = 30
    loose_innodb_rds_min_concurrency_tickets = 50
    loose_rds_ic_reduce_hint_enable = OFF
    max_write_lock_count = 102400
    innodb_old_blocks_time = 1000
    innodb_stats_method = nulls_equal
    loose_rds_deny_drop_db_contain_foreign_key = ON
    max_length_for_sort_data = 1024
    query_prealloc_size = 8192
    loose_opt_rds_last_trx_enabled = ON
    innodb_large_prefix = OFF
    delayed_insert_limit = 100
    group_concat_max_len = 1024
    innodb_disable_sort_file_cache = ON
    loose_tokudb_buffer_pool_ratio = 0
    loose_innodb_rds_autoinc_persistent = ON
    innodb_ft_min_token_size = 3
    loose_rds_enable_log_global_var_update = ON
    loose_opt_rds_last_error_gtid = ON
    loose_skip_symbolic_links = ON
    loose_tokudb_rpl_unique_checks = OFF
    key_cache_block_size = 1024
    loose_tokudb_directio = OFF
    slow_launch_time = 2
    loose_tokudb_fsync_log_period = 0
    loose_thread_handling = "one-thread-per-connection"
    loose_rds_allow_unsafe_stmt_with_gtid = ON
    innodb_online_alter_log_max_size = 134217728
    innodb_open_files = 3000
    eq_range_index_dive_limit = 10
    loose_innodb_adaptive_hash_index_parts = 8
    div_precision_increment = 4
    binlog_row_image = full
    loose_tokudb_row_format = tokudb_zlib
    innodb_strict_mode = OFF
    delayed_queue_size = 1000
    default_week_format = 0
    loose_opt_rds_enable_restrict_non_super_user = ON
    loose_rds_expand_fast_index_creation = ON
    log_queries_not_using_indexes = OFF
    innodb_read_ahead_threshold = 56
    loose_rds_audit_row_limit = 100000
    loose_slave_parallel_workers = 8
    connect_timeout = 10
    default_time_zone = SYSTEM
    loose_rds_slave_read_no_lock = ON
    loose_rds_restrict_stmt_for_mscheck = ON
    sql_mode = ''
    loose_rds_enable_shield_var = ON
    slave_exec_mode = strict
    loose_opt_rds_audit_log_enabled = 1
    query_cache_size = 3145728
    innodb_adaptive_hash_index = ON
    performance_schema = OFF
    innodb_purge_batch_size = 300
    loose_rds_file_operation_local_only = ON
    loose_innodb_rds_adaptive_tickets_algo = ON
    loose_rpl_semi_sync_slave_trace_level = 1
    loose_rpl_semi_sync_master_timeout = 1000
    loose_rpl_semi_sync_master_trace_level = 1
    loose_rpl_semi_sync_slave_enabled = ON
    loose_rpl_semi_sync_master_enabled = ON
    loose_rpl_semi_sync_master_wait_no_slave = ON
    
    [mysqldump]
    quick
    max_allowed_packet = 64M
    
    [mysql]
    no-auto-rehash
    prompt = "\\u@\\h : \\d \\R:\\m:\\s> "
    
    [myisamchk]
    key_buffer = 512M
    sort_buffer_size = 512M
    read_buffer = 8M
    write_buffer = 8M
    
    [mysqlhotcopy]
    interactive-timeout
    
    [mysqld_safe]
    user = mysql
    

    9 .修改执行脚本权限

    [root@localhost mysql]# chmod 755 scripts/mysql_install_db
    

    10 . 创建目录

    [root@localhost mysql]#mkdir /usr/local/mysql/tmp
    [root@localhost mysql]#chown -R mysql:mysql /usr/local/mysql
    

    11 . 执行

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

    12 . 复制服务脚本到系统

    [root@localhost mysql]#cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
    [root@localhost mysql]#chmod 755 /etc/init.d/mysqld
    [root@localhost mysql]#chkconfig mysqld on
    

    13 . 将mysql PATH添加到profile

    [root@localhost mysql]#echo "export PATH=/usr/local/mysql/bin:$PATH" >> /etc/profile
    [root@localhost mysql]#source /etc/profile
    

    14 . 启动服务

    [root@localhost mysql]#/etc/init.d/mysqld start
    

    15 . 查看服务状态

    [root@localhost mysql]#/etc/init.d/mysqld status
    如出现 SUCCESS! MySQL running 就表明服务已正常启动

    16 . 修改root登录密码, 这里为123456

    [root@localhost mysql]# mysql --protocol tcp
    root@localhost : (none) 21:05:39> use mysql //选择默认数据库mysql
    mysql>update user set password=password('123456') where user = 'root'; 修改root密码
    mysql>GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION;
    mysql>GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY '123456' WITH GRANT OPTION;
    mysql>flush privileges;
    mysql>exit;
    

    17 . 关闭服务

    [root@localhost mysql]# mysqladmin -uroot -p123456 -hlocalhost --protocol tcp shutdown```
    
    ####part.4小结
    centos的AliSQL安装就此就结束了,但是对centos7的探索仍将继续,后续我将继续更新其他的学习成功。

    相关文章

      网友评论

        本文标题:centos7,alisql5.6.32的安装

        本文链接:https://www.haomeiwen.com/subject/tmrrcxtx.html