单点失效 - mysql cluster 使用问题
ringa_lee
ringa_lee 2017-04-17 14:41:26
0
1
899

请问对于以上配置,使用数据库连接时:mysqli_connect("ip","user","password","db"),应该填写哪个ip地址?

比如选择SQL1节点的地址,即192.168.72.158,如果在使用时,该节点发生故障,数据库会自动切换到SQL2或者SQL3节点上吗

ringa_lee
ringa_lee

ringa_lee

reply all(1)
巴扎黑

Thanks for the invitation!

Cluster? The mysql cluster you are talking about is the integration of mysql server and NDB storage engine. Generally, if a certain service area fails, other servers will take over, so there is no single point of failure. Let me tell you the uses of these nodes:

  1. Management node: manages other nodes of mysql cluster and plays a configuration role.

  2. Data node: that is the one that saves data

  3. mysql node: used to access the data node that saves data, which is the entrance to data query

So you only need to execute the command on the SQL node and confirm that the db is on this server:

    $link = new mysqli('192.168.72.158','root',' root_password','db');
    
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!