Many things may be involved.
First, which of these are you talking about? (And what values do you have?)
"Threads_cached": "5", -- 1000 might be good for you
"Threads_connected": "10",
"Threads_created": "36404", -- divide by Uptime
"Threads_running": "4", -- 20 is a 'large' value
"Max_used_connections": "238",
"max_connections": "400", -- we may need to tune this to avoid the problem
How do you "load balance" the Slaves? Assuming that the connections are normally quick, "round robin" is better than any sophisticated method.
You should consider adding another Slave -- Keep in mind that if you lose a Slave (crash, maintenance, hiccup, etc), you will be back down to 3, which seems has the problem. Having 4 up-to-date slaves may make the problem much rarer.
The reason for throttling max_connections
is to throw the problem back to the client, forcing it to pick another Slave. (I assume you recover from connection error and try again?)
Please describe how the data comes in. It sounds like sensor data that is pushed from remote sensors? Is there anything that would cause it to "sync" -- that is everyone sends at the top of the minute? If so, is there a way to stagger the pushes?
Do the remote sensors do the following?
- connect to mysql
- insert one row (please provide details and
SHOW CREATE TABLE
)
- disconnect
? If not, please describe it.
Is there any "connection pooling"? You mentioned "maxscale"; are you using that?
What is the average number of connections over an hour (or day or whatever)? As a first cut, I would set max_connections
to twice that.
Please provide (1) RAM size, (2) SHOW VARIABLES
, (3) SHOW GLOBAL STATUS
after mysql has been running for a day. This may give more insight into the problems.
Be aware that although mariadDB loads configuration details from various my.cnf files it can also load them from other files with different names.
That means that if you make a change in one of the my.cnf files, it may get overwritten by another file of a different name. To make the change stick, you need to change it in the right (last loaded) config file - or, maybe, change it in all of them.
So how do you find all the config files that might be loaded? Instead of looking for my.cnf files, try running:
grep -r datadir /etc/mysql/
This will find all the places in which datadir is mentioned. In my case, it produces this answer:
/etc/mysql/mariadb.conf.d/50-server.cnf:datadir = /var/lib/mysql
When I edit that file (/etc/mysql/mariadb.conf.d/50-server.cnf) to change the value for datadir (in my case to /media/USBHDD2/shared/mysql ), it works, whereas changing it in my.cnf does not.
However, you then have to make sure that the hard drive is mounted before mariadDB starts up, otherwise the startup will fail. And also make sure that the ownership of the directory and files on your mounted drive is mysql:mysql - a problem if the filestructure is ntfs rather than EXT4. see my own problem and solution here
Best Answer
This is a function of the client. You can't set it on the server. MySQL ships with a client, and a server. The client determines the prompt. There is nothing you can do on the server to fix that. The client could be something totally different that has for its prompt
You can see the code here
construct_prompt()
. Nothing there hits the server. That said, it gets set here in the mainSo it would seem you could set it through the
MYSQL_PS1
environmental variable.