Changes between Initial Version and Version 1 of proxysql


Ignore:
Timestamp:
Dec 12, 2022, 2:24:26 PM (3 years ago)
Author:
Jamie McClelland
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • proxysql

    v1 v1  
     1= Proxy SQL =
     2
     3Previously all web servers ran a local MySQL instance for web applications to use.
     4
     5We are transitioning to using dedicated, network MySQL servers that listen on a private IP range. To ensure that web applications can continue connecting using "localhost", we are using the [https://docs.mayfirst.org/proxysql/ ProxySQL package].
     6
     7== Steps to transition ==
     8
     9To transition a Mosh to using proxysql:
     10
     111. Update the puppet file for the mosh. Add:
     12{{{
     13class { "mayfirst::m_proxysql::mosh":
     14  transition => true
     15}
     16if ( $::fqdn in $::mfpl_mysql_servers ) {
     17    mayfirst::m_proxysql::permit_host { "REPLACE-WITH-MOSH-NAME": }
     18}
     19}}}
     20
     212. Push puppet changes to both lumumba and pachamama (and any future network database servers) to grant the new mosh access to the non-privileged service that provides a map of database usernames to network database servers. Note: our network database servers are still under puppet, this will change when we move them to ansible.
     22
     233. Push puppet changes to the mosh. You may have to push twice (still don't have the proper ordering). At this point, ''both'' MySQL and ProxySQL are running on the mosh. ProxySQL is proxying all connections and passing them directly to the local MySQL instance (which is now listing on the non-standard port 3307 of localhost). This step incurs a few minutes of downtime. When complete, we should see an increase in CPU since we are supporting both ProxySQL and MySQL on the same host.
     24
     254. Login to the network database server you want to move the databases to and run the [https://docs.mayfirst.org/transfer/ mf-transfer] script. You have to run it one database at a time. As soon as the database transition is complete, ProxySQL will seemlessly switch to the network database, so there is no down time. BUT - there may be data loss if data is added to the database after the database is dumped, but before the database is imported. For a large database that could be 10 to 15 minutes.
     26
     275. When complete, check the ProxySQL database for any remaining local database users: `mysql -e "SELECT * FROM mysql_users WHERE default_hostgroup = 999" main`