Hello,
I'm trying to switch from a single mysql server to a new vitess managed cluster.
I have two keyspaces available.
The first one is named brandnew, which is a new keyspace started with the script 101_initial_cluster.sh and a custom vschema.json and sql schema.
It is an unmanaged mysql server containing my data.
I've been trying to use the MoveTable process from the legacy keyspace to the brandnew keyspace in order to migrate my data from a regular mysql server to a vitess cluster.
Here is my vttablet state:
+-------+----------+-------+------------+---------+------------------+----------+
| Cell | Keyspace | Shard | TabletType | State | Alias | Hostname |
+-------+----------+-------+------------+---------+------------------+----------+
| zone1 | brandnew | 0 | MASTER | SERVING | zone1-0000000100 | BXDGK13 |
| zone1 | brandnew | 0 | REPLICA | SERVING | zone1-0000000101 | BXDGK13 |
| zone1 | brandnew | 0 | RDONLY | SERVING | zone1-0000000102 | BXDGK13 |
| zone1 | legacy | 0 | MASTER | SERVING | zone1-0000000401 | BXDGK13 |
+-------+----------+-------+------------+---------+------------------+----------+
I run the MoveTable process like this:
vtctlclient MoveTables -tablet_types=master -workflow=legacy2brandnew legacy brandnew '{<my tables list>}'
I've got some errors I don't understand like
E0915 16:20:45.480627 8237 main.go:67] remote error: rpc error: code = Unknown desc = source table TRM_VALUESET_C_DESIGNATIONES_REINDEX_ARCHIVED does not exist
I dont understand the error because the table exists in legacy keyspace, but anyway I gave it a try and it seemed to work (at least for some other tables I was interested in).
Example:
mysql brandnew -e 'select ID from RESOURCE LIMIT 1';
+--------+
| ID |
+--------+
| 1 |
+--------+
So now trouble begins. I kept following the documentation and ran the following commands:
vtctlclient SwitchReads -tablet_type=rdonly brandnew.legacy2brandnew
vtctlclient SwitchReads -tablet_type=replica brandnew.legacy2brandnew
vtctlclient SwitchWrites brandnew.legacy2brandnew
vtctlclient DropSources brandnew.legacy2brandnew
All of them ended up with the following error:
I0915 16:26:16.160432 8453 trace.go:151] successfully started tracing with [noop]
E0915 16:26:16.174098 8453 main.go:64] E0915 14:26:16.171597 traffic_switcher.go:112] buildTrafficSwitcher failed: no streams found in keyspace brandnew for: legacy2brandnew
E0915 16:26:16.175093 8453 main.go:67] remote error: rpc error: code = Unknown desc = no streams found in keyspace brandnew for: legacy2brandnew
Then I shutdown my remote unmanaged mysql server and try the same request as before:
mysql brandnew -e 'select ID from RESOURCE LIMIT 1';
which results with error because the unmanaged server was shut down.
E0915 16:29:00.740713 7574 tabletserver.go:1522] net.Dial(127.0.0.1:4306) failed: dial tcp 127.0.0.1:4306: connect: connection refused (errno 2003) (sqlstate HY000) (CallerID: userData1): Sql: "select ID from RESOURCE limit :vtg1", BindVars: {#maxLimit: "type:INT64 value:\"10001\" "vtg1: "type:INT64 value:\"1\" "} I0915 16:29:00.741149 7574 tabletserver.go:693] Check MySQL failed. Shutting down query service
I0915 16:29:00.741214 7574 tabletserver.go:332] TabletServer state: SERVING -> SHUTTING_DOWN (Shutting Down)
I0915 16:29:00.741251 7574 tabletserver.go:593] Executing complete shutdown.
I0915 16:29:00.741334 7574 tx_engine.go:407] No grace period specified: performing normal wait.
I0915 16:29:00.742552 7574 tabletserver.go:601] Shutdown complete.
I0915 16:29:00.742600 7574 tabletserver.go:332] TabletServer state: SHUTTING_DOWN (Shutting Down) -> NOT_SERVING (Not Connected)
ERROR 2003 (HY000) at line 1: vtgate: http://BXDGK13:15001/: target: legacy.0.master, used tablet: zone1-401 (BXDGK13): vttablet: rpc error: code = Unknown desc = net.Dial(127.0.0.1:4306) failed: dial tcp 127.0.0.1:4306: connect: connection refused (errno 2003) (sqlstate HY000) (CallerID: userData1): Sql: "select ID from RESOURCE limit :vtg1", BindVars: {#maxLimit: "type:INT64 value:\"10001\" "vtg1: "type:INT64 value:\"1\" "}
I tried to reset the Routing Rules with vtctlclient ApplyRoutingRules -rules='{}'
After that, I don't have errors anymore (since queries aren't routed anymore to legacy server), but I can't retrieve any data. So i guess no data was copied from legacy to brandnew keyspace, which was my initial goal.
Do you have any idea what I'm doing wrong or misunderstood ?
Thank you