Abhimanyu
Abhimanyu

Reputation: 2740

Difficulty configuring ProxySQL for sharding MySQL based on ID field

I am currently evaluating ProxySQL for sharding MySQL databases. In my Proof of Concept (POC), I aim to shard data based on the ID field. Specifically, I want odd IDs to be routed to host_group1 (shard1) and even IDs to host_group2 (shard2). However, I've encountered challenges configuring ProxySQL's MySQL query rules to achieve this. Despite trying multiple configurations, I haven't been successful. I'm using Spring Boot and Hibernate to connect to ProxySQL.


 username: stnduser
              password: stnduser
                active: 1
               use_ssl: 0
     default_hostgroup: 1
        default_schema: NULL
         schema_locked: 0
transaction_persistent: 1
          fast_forward: 0
               backend: 1
              frontend: 1
       max_connections: 10000
            attributes:
               comment:```

mysql_servers : 
 hostgroup_id: 1
           hostname: 127.0.0.1
               port: 3306
          gtid_port: 0
             status: ONLINE
             weight: 1
        compression: 0
    max_connections: 1000
max_replication_lag: 0
            use_ssl: 0
     max_latency_ms: 0
            comment:
*************************** 2. row ***************************
       hostgroup_id: 2
           hostname: 192.168.240.1
               port: 3306
          gtid_port: 0
             status: ONLINE
             weight: 1
        compression: 0
    max_connections: 1000
max_replication_lag: 0
            use_ssl: 0
     max_latency_ms: 0
            comment:```

Please help me out with mysql_query_rules.


Upvotes: 1

Views: 91

Answers (0)

Related Questions