Jelajahi Sumber

setup some users

Chris Mague 2 tahun lalu
induk
melakukan
88b7e5481c
3 mengubah file dengan 31 tambahan dan 2 penghapusan
  1. 7 0
      README.md
  2. 20 2
      proxysql.cnf
  3. 4 0
      users.sql

+ 7 - 0
README.md

@@ -27,3 +27,10 @@ mysql --protocol tcp  -P 3308 -u root -pmysql2
 ```
 mysql --protocol tcp -P 16033 -u monitoruser -pmonitorpass
 ```
+
+## Add Some Data
+
+```
+mysql --protocol tcp  -P 3307 -u root -pmysql1 < users.sql
+```
+

+ 20 - 2
proxysql.cnf

@@ -47,7 +47,7 @@ mysql_servers =
   {
     address="mysql1"
     port=3307
-    hostgroup=1
+    hostgroup=0
     max_connections=200
   },
   {
@@ -63,9 +63,27 @@ mysql_users:
   {
     username = "monitoruser"
     password = "monitorpass"
-    default_hostgroup = 1
+    default_hostgroup = 0
     max_connections=1000
     default_schema="application"
     active = 1
   }
 )
+
+mysql_query_rules:
+(
+  {
+    rule_id=1
+    active=1
+    match_pattern="^SELECT .* FOR UPDATE$"
+    destination_hostgroup=0
+    apply=1
+  },
+  {
+    rule_id=2
+    active=1
+    match_pattern="^SELECT"
+    destination_hostgroup=1
+    apply=1
+  }
+)

+ 4 - 0
users.sql

@@ -0,0 +1,4 @@
+USE application;
+CREATE TABLE Users (UserID int, LastName varchar(255), FirstName varchar(255), Email varchar(255));
+INSERT INTO Users values (1, "Lee", "Geddy", "geddy@rush.com");
+INSERT INTO Users values (2, "Lifeson", "Alex", "alex@rush.com");