redochka
redochka

Reputation: 12829

mysql_query_rules defined in proxysql.cnf but not loaded

My proxysql.cnf contains:

# ...
mysql_query_rules:
(
    {
        active = 1
        match_digest = "^SHOW.*"
        destination_hostgroup = 3
        apply = 0
    },
    {
        active = 1
        match_digest = "^SELECT.*"
        destination_hostgroup = 3
        apply = 0
    },
    {
        active = 1
        match_digest = "^SELECT.* FOR UPDATE"
        destination_hostgroup = 2
        apply = 1
    },
)

# ...

But when proxysql starts, the mysql_query_rules defintion is not loaded.

select * from mysql_query_rules;
Empty set (0.001 sec)

How to make proxysql loads the mysql_query_rules definition from the proxysql.cnf file at startup?

Upvotes: 0

Views: 415

Answers (2)

Abhimanyu
Abhimanyu

Reputation: 2740

You need to follow the below-mentioned steps :

  1. Insert into mysql_query_table
  2. LOAD MYSQL QUERY RULES TO RUNTIME;
  3. SAVE MYSQL QUERY RULES TO DISK;

After this your query will be persisted

Upvotes: 0

redochka
redochka

Reputation: 12829

The rule_id field is mandatory.

{
   rule_id=1
   active = 1
   match_digest = "^SHOW.*"
   destination_hostgroup = 3
   apply = 0
},

Upvotes: 0

Related Questions