Rate This Document
Findability
Accuracy
Completeness
Readability

Verifying Read/Write Splitting and Load Balancing

  1. Perform steps 1 to 3 in Verifying Read/Write Splitting and Load Balancing.
  2. Perform a query test.
    1. Execute the read request script.
      1
      sh /home/read_6446.sh
      

      Read requests of port 6446 are sent to the primary node (127.0.0.1:3307) in polling mode as expected.

    2. Execute the read request script.
      sh /home/read_6447.sh

      Read requests of port 6447 are sent to the three primary nodes in polling mode as expected.

  3. Perform a write test.
    1. Open the file.
      vim /home/write_6446.sh
    2. Add the following content to the file:
      1
      2
      3
      4
      5
      #!/bin/bash
      for i in {1..1000}
      do
      /usr/local/mysql/bin/mysql -uroot -p123456 -P6446 -h127.0.0.1 -Dsysbench -e "insert into test1(id,report_serverid) values($i,@@server_id)"
      done
      
    3. Press Esc, type :wq!, and press Enter to save the file and exit.
    4. Execute the write request script.
      1
      sh /home/write_6446.sh
      
    5. Confirm the test data.
      1
      /usr/local/mysql/bin/mysql -uroot -p123456 -P6446 -h127.0.0.1 -Dsysbench -e "select * from test1"
      

      Write requests of port 6446 are sent to the primary node (127.0.0.1:3307) in polling mode as expected.

    6. Perform a write test through port 6447.
      1. Open the file.
        vim /home/write_6447.sh
      2. Add the following content to the file:
        1
        2
        3
        4
        5
        #!/bin/bash
        for i in {1001..2000}
        do
        /usr/local/mysql/bin/mysql -uroot -p123456 -P6447 -h127.0.0.1 -Dsysbench -e "insert into test1(id,report_serverid) values($i,@@server_id)"
        done
        
      3. Press Esc, type :wq!, and press Enter to save the file and exit.
      4. Execute the write request script.
        1
        sh /home/write_6447.sh
        
      5. Confirm the test data.
        1
        /usr/local/mysql/bin/mysql -uroot -p123456 -P6447 -h127.0.0.1 -Dsysbench -e "select * from test1"
        

        Write requests of port 6447 are sent to the three primary nodes in polling mode as expected.