我用一台2颗4核cpu  32G内存的 服务器, 分出10台虚拟机, 
搭建了一个mysql集群, 用.net链接测试的时候, 经常出现connection timeout 追加参数
链接改为
MySqlConnection("datasource=192.168.6.185;username=admin;password=1;database=piwik;Pooling=False;") 不出错
但是sql节点负载很高, 并发效率也不好
远远比不上我自己编译的mysql进行监测的时候发现cpu资源耗光了 虚拟机145%的cpu消耗
真是搞不明白 

解决方案 »

  1.   

    # For advice on how to change settings please see
    # http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html[mysqld]# Remove leading # and set to the amount of RAM for the most important data
    # cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
    # innodb_buffer_pool_size = 128M# Remove leading # to turn on a very important data integrity option: logging
    # changes to the binary log between backups.
    # log_bin# These are commonly set, remove the # and set as required.
    # basedir = .....
    # datadir = .....
    # port = .....
    # server_id = .....
    # socket = .....# Remove leading # to set options mainly useful for reporting servers.
    # The server defaults are faster for transactions and fast SELECTs.
    # Adjust sizes as needed, experiment to find the optimal values.
    # join_buffer_size = 128M
    # sort_buffer_size = 2M
    # read_rnd_buffer_size = 2M [client]
    socket=/usr/local/mysql/sock/mysql.sock[mysqld]
    ndbcluster
    datadir=/usr/local/mysql/data
    socket=/usr/local/mysql/sock/mysql.sock
    default-storage-engine = ndbcluster
    key_buffer_size = 600M
    max_allowed_packet = 100M
    table_open_cache = 2048
    sort_buffer_size = 1024M
    net_buffer_length = 8K
    read_buffer_size = 400M
    read_rnd_buffer_size = 200M
    lower_case_table_names =1 
    back_log = 384
    thread_stack = 256K
    join_buffer_size = 500M
    thread_cache_size = 200
    query_cache_size = 640M
    tmp_table_size = 256M
    max_connections = 5000
    max_connect_errors = 10000000 
    wait_timeout = 2880000
    interactive_timeout = 2880000
    thread_concurrency = 8
    ndb-connectstring=192.168.6.180[mysql_cluster]
    ndb-connectstring=192.168.6.180
    这个是我sql节点的配置