Update the maximum_memory
global variable in the memsql.cnf
file on each node (agg, leaf1, and leaf2) to be what you want, then restart the cluster. You can do this with memsql-admin
similar to the following (I’m running a single agg and leaf on one machine for this example, but you can do something similar for your scenario):
First, get the node IDs:
vagrant@memsqldev ~ $ memsql-admin list-nodes
+------------+--------+-----------+------+---------------+--------------+---------+----------------+--------------------+
| MemSQL ID | Role | Host | Port | Process State | Connectable? | Version | Recovery State | Availability Group |
+------------+--------+-----------+------+---------------+--------------+---------+----------------+--------------------+
| 52EBC44525 | Master | 127.0.0.1 | 3306 | Running | True | 6.7.1 | Online | |
| 77C92E61CA | Leaf | 127.0.0.1 | 3308 | Running | True | 6.7.1 | Online | 1 |
+------------+--------+-----------+------+---------------+--------------+---------+----------------+--------------------+
Now, let’s say we want to update the master node to have maximum_memory
= 4106 KB and the leaf node to have 8108 KB. We’d do this:
memsql-admin update-config --key maximum_memory --value 4106 --memsql-id 52EBC44525
memsql-admin update-config --key maximum_memory --value 8108 --memsql-id 77C92E61CA
memsql-admin restart-node --all
Then, you can check that the nodes have the amount of memory you want by querying mv_nodes
:
$ memsql
Welcome to the MySQL monitor...
memsql> use information_schema
Database changed
memsql> select * from mv_nodes;
+----+-----------+------+------+--------+--------------------+----------+---------------+---------------------+----------------+----------------------+--------------------+------------------------+
| ID | IP_ADDR | PORT | TYPE | STATE | AVAILABILITY_GROUP | NUM_CPUS | MAX_MEMORY_MB | MAX_TABLE_MEMORY_MB | MEMORY_USED_MB | TABLE_MEMORY_USED_MB | TOTAL_DATA_DISK_MB | AVAILABLE_DATA_DISK_MB |
+----+-----------+------+------+--------+--------------------+----------+---------------+---------------------+----------------+----------------------+--------------------+------------------------+
| 2 | 127.0.0.1 | 3308 | LEAF | online | 1 | 4 | 8108 | 7084 | 2889 | 250 | 98396 | 80201 |
| 1 | 127.0.0.1 | 3306 | MA | online | NULL | 4 | 4106 | 3082 | 839 | 51 | 98396 | 80201 |
+----+-----------+------+------+--------+--------------------+----------+---------------+---------------------+----------------+----------------------+--------------------+------------------------+
You can see your total used cluster memory capacity as follows:
memsql> show status extended like 'used_cluster_capacity';
+-----------------------+----------+
| Variable_name | Value |
+-----------------------+----------+
| Used_cluster_capacity | 12214 MB |
+-----------------------+----------+
This must be at most 131072 MB, which is 128 * 1024 MB, for the free license version.
For more background, see the documentation here regarding changing the .cnf file:
Folders containing the .cnf files for the nodes are typically under: /var/lib/memsql/
. To tell what subfolder corresponds to what node (the folder names are GUIDs), you can look at the port number in the memsql.cnf
file in the folder named with a GUID. This is not really necessary since you can use memsql-admin
to do what you need, as outlined above. But you can see the effects this way.