You are browsing a read-only backup copy of Wikitech. The live site can be found at wikitech.wikimedia.org

Difference between revisions of "MariaDB/Multiinstance"

From Wikitech-static
Jump to navigation Jump to search
imported>Kormat
(Minor grammar fix.)
 
imported>LSobanski
 
(One intermediate revision by one other user not shown)
Line 2: Line 2:


== Single-instance hosts ==
== Single-instance hosts ==
Mariadb runs on port <code>:3306</code>, and is controlled by the <code>mariadb.service</code> systemd unit. Monitoring is provided by the <code>prometheus-mysqld-exporter.service</code> unit.
Mariadb runs on port <code>:3306</code>, and is controlled by the <code>mariadb.service</code> systemd unit. Monitoring is provided by the <code>prometheus-mysqld-exporter.service</code> unit. This instance is referred to by internal tools as the plain hostname, e.g. <code>db1159</code>.


== Multi-instance hosts ==
== Multi-instance hosts ==
Line 8: Line 8:


The mapping from section to port is controlled by [https://github.com/wikimedia/puppet/blob/e96ee882df0e4a0f0d3eda65c141fcbec2eefb2d/hieradata/common/profile/mariadb.yaml#L1-L25 this] list. <code>s1</code> instances on multi-instances hosts run on <code>:3311</code>, m5 multi-instances run on <code>:3325</code>, and so on.
The mapping from section to port is controlled by [https://github.com/wikimedia/puppet/blob/e96ee882df0e4a0f0d3eda65c141fcbec2eefb2d/hieradata/common/profile/mariadb.yaml#L1-L25 this] list. <code>s1</code> instances on multi-instances hosts run on <code>:3311</code>, m5 multi-instances run on <code>:3325</code>, and so on.
These instances are referred to by internal tools as the plain hostname + the port. E.g. <code>db1000:3311</code>, <code>db1000:3325</code>, etc.


The systemd unit is more straight-forward, it's <code>mariadb@<nowiki><section>.service</nowiki></code>. So <code>s4</code> would be <code>mariadb@s4.service</code>.
The systemd unit is more straight-forward, it's <code>mariadb@<nowiki><section>.service</nowiki></code>. So <code>s4</code> would be <code>mariadb@s4.service</code>.
Line 29: Line 31:
The last Puppet run was at Fri Jun  4 13:17:58 UTC 2021 (8 minutes ago).  
The last Puppet run was at Fri Jun  4 13:17:58 UTC 2021 (8 minutes ago).  
...
...
</syntaxhighlight>This is a multi-instance host; it has 4 sections listed.{{SRE/Data Persistence/Footer}}
</syntaxhighlight>This is a multi-instance host; it has 4 sections listed.
 
{{SRE/Data Persistence/Footer}}
 
[[Category:MariaDB]]

Latest revision as of 09:39, 9 June 2021

Our database hosts can run either a single mariadb instance (single-instance) or multiple (multi-instance). This affects how they are addressed over the network, and the systemd setup within the host itself.

Single-instance hosts

Mariadb runs on port :3306, and is controlled by the mariadb.service systemd unit. Monitoring is provided by the prometheus-mysqld-exporter.service unit. This instance is referred to by internal tools as the plain hostname, e.g. db1159.

Multi-instance hosts

The mariadb port and systemd unit name are determined by the sections the host is in.

The mapping from section to port is controlled by this list. s1 instances on multi-instances hosts run on :3311, m5 multi-instances run on :3325, and so on.

These instances are referred to by internal tools as the plain hostname + the port. E.g. db1000:3311, db1000:3325, etc.

The systemd unit is more straight-forward, it's mariadb@<section>.service. So s4 would be mariadb@s4.service.

Monitoring uses the same scheme. E.g. the exporter for m3 on multi-instance hosts is prometheus-mysqld-exporter@m3.service.

Determining if a host is single- or multi-instance

The simplest clue is to look at the motd on login. For example:

...
db1159 is a Misc DB Server (mariadb::core)
DB section m1
The last Puppet run was at Fri Jun  4 13:11:28 UTC 2021 (12 minutes ago). 
...

This is a single-instance host; there's only one section listed. Compare with:

...
dbstore1005 is a DBStore multi-instance server (mariadb::dbstore_multiinstance)
DB section s6
DB section s8
DB section staging
DB section x1
The last Puppet run was at Fri Jun  4 13:17:58 UTC 2021 (8 minutes ago). 
...

This is a multi-instance host; it has 4 sections listed.



This page is a part of the SRE Data Persistence technical documentation
(go here for a list of all our pages)