Home  >  Q&A  >  body text

单点失效 - mysql cluster 使用问题

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

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

ringa_leeringa_lee2742 days ago880

reply all(1)I'll reply

  • 巴扎黑

    巴扎黑2017-04-17 14:43:26

    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');
        

    reply
    0
  • Cancelreply