Connection problems
Why a client cannot connect or log in to raftdb-mysql or raftdb-server, and why a connection drops, with the errors each case produces.
MySQL and MariaDB clients (raftdb-mysql)#
| Symptom | Cause | Fix |
|---|---|---|
Can't connect to MySQL server on '127.0.0.1' (111) or (10061) | Nothing listens on that address and port | Start raftdb-mysql; check listen (default 127.0.0.1:3307). Use TCP: the client's localhost means a socket file on Unix. |
| Connects from the machine, not from another | listen is on loopback (the default) | Set listen = 0.0.0.0:3306 only on a network you control and through a tunnel or firewall (Network exposure). |
ERROR 1045 (28000): Login refused for user 'app'@'localhost' (password supplied: YES) | Wrong user or password, or no such user. A loopback client is shown as localhost. | Check the user = NAME:PASSWORD line (a # cuts a password) or the CREATE USER account and its host ('app'@'%' matches every host). |
ERROR 1045 ... (password supplied: NO) | The client sent no password | Add -p. |
ERROR 1040 (08004): Too many connections | max_connections (default 500) reached | Raise it, or fix connection leaks in the application. |
| MariaDB client: a TLS or SSL error at connect | The MariaDB 11.4 client asks for TLS and the front-end offers none (no ssl_cert), or the certificate does not verify | Configure TLS (TLS and encryption), or add --skip-ssl (Connecting); with --ssl-verify-server-cert give --ssl-ca the server certificate. |
mysql --ssl-mode=REQUIRED fails | No TLS is offered (no ssl_cert / ssl_key / ssl = auto) | Configure TLS on the front-end; without it remove the option or use a tunnel. |
ERROR 3159 (HY000): Connections using insecure transport are prohibited | ssl_mode = required and the client did not use TLS | Use TLS in the client (--ssl-mode=REQUIRED, sslMode=REQUIRED), or set ssl_mode = preferred. |
VERIFY_CA or VERIFY_IDENTITY fails (certificate verify failed) | The client does not have the server certificate as its CA, or the certificate does not name the host used | Pass the certificate as the CA (--ssl-ca); make a certificate with the host name or address in its alternative names. A certificate made by ssl = auto is new at each start and cannot be verified. |
ERROR 2013 (HY000): Lost connection to MySQL server at 'reading initial communication packet' or during query | The server stopped or restarted; the login took longer than 10 seconds; a firewall closed the connection; or the front-end lost its link to Raft DB | Check the process; with embed look at the start-up lines; check raftdb-server in two-process mode. |
ERROR 2013 ... Lost connection to Raft DB: ... (message from raftdb-mysql) | In two-process mode the link to raftdb-server broke | Check raftdb-server, its address in raftdb, and the account of raftdb_user. |
Login succeeds, then every statement fails with Raft DB: ... (error 1105) | The front-end's own account (raftdb_user) is wrong or lacks a role the statement needs, or the server answers with a refusal | Check raftdb_user and raftdb_password; give it admin if the MySQL users create databases. |
A client that required UTF-8 data gets error 1366 Incorrect string value: the statement is not valid UTF-8 | The text of a COM_QUERY is not UTF-8 | Send UTF-8, or binary data as hexadecimal or _binary literals, or as prepared-statement parameters. |
Find out what a client sends: start raftdb-mysql with RAFTDB_MYSQL_TRACE=1 in the environment. Each login logs the client's capabilities and plugin; each statement is logged with its outcome. Statements with passwords are logged in clear: delete the output.
Native clients and HTTP (raftdb-server)#
| Symptom | Cause | Fix |
|---|---|---|
| Connection refused | Server not running, wrong port, or loopback-only addr | Check raftdb-server --print-config; the single profile listens on 127.0.0.1 only. |
HTTP 401 unauthenticated ("log in (POST /v1/auth/login) or send Authorization: Bearer ...") | No login | Log in; the password of admin is in <dir>/admin.password. |
401 "wrong user name or password" (after 250 ms) | Wrong account | Check the user lines; remember that passwords with : need care: a last part counts as a role only if it is one. |
HTTP 403 forbidden; binary error 11 FORBIDDEN | The account's role or database scope does not allow it | Check GET /v1/auth/whoami. |
HTTP 403 read_only_replica; binary error 12 READ_ONLY | A replica, or a managed node that is not the primary | Write to the primary, or POST /v1/promote on a replica you are making the primary. |
HTTP 409 not_leader with an address | Table-group mode: this node does not lead the table | Use the node named in the answer, or the binary protocol (it forwards). |
HTTP 400 confirm_required | A drop without the exact name in the body | Send {"confirm": "<name>"}. |
HTTP 503 or 404 after a drop or rename | The table was dropped or renamed under the connection | Reconnect and Use the new name. |
| A binary connection is closed after a bad frame | The frame was malformed (frames are 5 bytes to 16 MiB) | Fix the client; the server answers with an error then closes. |
| Browser: the Studio cannot reach another server | Cross-origin rules | Set cors on the called server and allow-remote-servers on the Studio's server (HTTP administration API). |
Connections that drop#
- Idle connections: no idle timeout is documented for them; a firewall or load balancer in between may close them.
- A table is checkpointed, dropped or renamed: connections on it fail and must reconnect.
- The server was killed: a statement in progress gets a lost-connection error; retry after checking whether the write happened.
- In two-process mode a dropped table fails the sessions on it with a "table was not found" error (1146) instead of closing their connections.