• MySQL主从复制配置


    参考文档: 

    MySQL主从复制配置

    一台MySQL服务器启动多个端口

    /usr/local/mysql-bbs/bin/mysqld --basedir=/usr/local/mysql-bbs --datadir=/usr/local/mysql-bbs/data --plugin-dir=/usr/local/mysql-bbs/lib/plugin --user=mysql --log-error=/usr/local/mysql-bbs/data/product.kimiss.com.err --open-files-limit=8192 --pid-file=/usr/local/mysql-bbs/data/product.pid --socket=/tmp/mysql-bbs.sock --port=3307

    /usr/local/mysql-product/bin/mysqld --basedir=/usr/local/mysql-product --datadir=/usr/local/mysql-product/data --plugin-dir=/usr/local/mysql-product/lib/plugin --user=mysql --log-error=/usr/local/mysql-product/data/product.kimiss.com.err --open-files-limit=8192 --pid-file=/usr/local/mysql-product/data/product.pid --socket=/tmp/mysql-product.sock --port=3306

    /usr/local/mysql-bbs 下的目录,把mysql相关的内容都移动到这个文件中 bin   中包含/usr/bin/mysql*   /usr/sbin/mysql*

    drwxr-xr-x 5 root root 4096 12月 12 13:45 ./
    drwxr-xr-x 13 root root 4096 12月 12 11:37 ../
    drwxr-xr-x 2 root root 4096 12月 12 11:48 bin/
    drwxr-xr-x 2 root root 4096 8月 25 21:16 conf.d/
    lrwxrwxrwx 1 root root 27 12月 12 11:43 data -> /export/data/mysql-bbs/data/
    lrwxrwxrwx 1 root root 18 12月 12 11:41 include -> /usr/include/mysql/
    drwxr-xr-x 2 root root 4096 12月 12 11:18 lib/
    -rw-r--r-- 1 root root 1685 12月 12 12:08 my.cnf
    lrwxrwxrwx 1 root root 16 12月 12 11:20 share -> /usr/share/mysql/

    访问:  

    mysql -uroot -proot -h127.0.0.1 -P3306
    mysql -uroot -proot -h127.0.0.1 -P3307

    my.cnf   配置文件中client port都是3306,mysqld是各自的端口

    [client]
    port = 3306
    socket = /tmp/mysql-product.sock

    [mysqld]
    bind-address = 127.0.0.1
    port = 3306
    socket = /tmp/mysql-product.sock
    back_log = 50
    max_connections = 1000
    max_connect_errors = 10
    table_open_cache = 2048
    max_allowed_packet = 16M
    binlog_cache_size = 1M
    max_heap_table_size = 64M
    read_buffer_size = 2M
    read_rnd_buffer_size = 16M
    sort_buffer_size = 8M
    join_buffer_size = 8M
    thread_cache_size = 8
    thread_concurrency = 8
    query_cache_size = 64M
    query_cache_limit = 2M
    ft_min_word_len = 4
    default-storage-engine = MYISAM
    thread_stack = 192K
    transaction_isolation = REPEATABLE-READ
    tmp_table_size = 64M
    slow_query_log
    long_query_time = 2

    #log-bin=mysql-bin
    #binlog_format=mixed
    server-id = 1
    #binlog-do-db=gaojie100
    ##binlog-do-db=gaojie_brand
    ##binlog-do-db=gaojie_manage
    ##binlog-do-db=log_data
    ##binlog-do-do=xf_stats
    binlog-ignore-db=mysql


    key_buffer_size = 32M
    bulk_insert_buffer_size = 64M
    myisam_sort_buffer_size = 128M
    myisam_max_sort_file_size = 2G
    myisam_repair_threads = 1
    myisam_recover
    innodb_additional_mem_pool_size = 16M
    innodb_buffer_pool_size = 512M
    innodb_data_file_path = ibdata1:10M:autoextend
    innodb_write_io_threads = 8
    innodb_read_io_threads = 8
    innodb_thread_concurrency = 16
    innodb_flush_log_at_trx_commit = 1
    innodb_log_buffer_size = 8M
    innodb_log_file_size = 256M
    innodb_log_files_in_group = 3
    innodb_max_dirty_pages_pct = 90
    innodb_lock_wait_timeout = 120

    [mysqldump]
    quick
    max_allowed_packet = 16M

    [mysql]
    no-auto-rehash

    [myisamchk]
    key_buffer_size = 512M
    sort_buffer_size = 512M
    read_buffer = 8M
    write_buffer = 8M

    [mysqlhotcopy]
    interactive-timeout

    [mysqld_safe]
    open-files-limit = 8192

    遇到的问题

    141212 13:53:30 [Note] Plugin 'FEDERATED' is disabled.
    141212 13:53:30 InnoDB: The InnoDB memory heap is disabled
    141212 13:53:30 InnoDB: Mutexes and rw_locks use GCC atomic builtins
    141212 13:53:30 InnoDB: Compressed tables use zlib 1.2.3.4
    141212 13:53:30 InnoDB: Initializing buffer pool, size = 128.0M
    141212 13:53:30 InnoDB: Completed initialization of buffer pool
    141212 13:53:30 InnoDB: highest supported file format is Barracuda.
    141212 13:53:30 InnoDB: Waiting for the background threads to start
    141212 13:53:31 InnoDB: 5.5.38 started; log sequence number 1618567
    141212 13:53:31 [Note] Server hostname (bind-address): '127.0.0.1'; port: 3306
    141212 13:53:31 [Note] - '127.0.0.1' resolves to '127.0.0.1';
    141212 13:53:31 [Note] Server socket created on IP: '127.0.0.1'.
    141212 13:53:31 [ERROR] /usr/local/mysql-product/bin/mysqld: Can't create/write to file '/usr/local/mysql-product/data/product.pid' (Errcode: 13)
    141212 13:53:31 [ERROR] Can't start server: can't create PID file: Permission denied

    cd /usr/local/mysql-product/data

     chmod 777 .

  • 相关阅读:
    dll学习
    mysql解压版安装
    mysql创建用户以及搭建数据库
    Springboot使用mybatis-plus
    分布式系统
    2、Zookeeper安装以及dubbo-admin的安装启动
    搭建分布式系统(idea+springboot+dubbo)
    Zookeeper下载和启动
    Spring Cloud底层原理
    Redis
  • 原文地址:https://www.cnblogs.com/bandbandme/p/4152936.html
Copyright © 2020-2023  润新知