summaryrefslogtreecommitdiffstats
path: root/doc/server/plugins/generators/tgenshi/mycnf.txt
blob: 7cf48ece0d6e9438935661a694b7051e64ef1874 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
.. -*- mode: rst -*-

.. _server-plugins-generators-tgenshi-mycnf:

mycnf
=====

The following template generates a ``server-id`` based on the last two
numeric parts of the IP address. The "slave" portion of the configuration
only applies to machines in the "slave" group.::

    {% python
    from genshi.builder import tag
    import socket
    parts = socket.gethostbyname(metadata.hostname).split('.')
    server_id = parts[2] + parts[3]
    %}\
    [mysqld]

    # [snip]

    server-id = ${server_id}

    # Replication configuration

    {% if "slave" in metadata.groups %}\
    relay-log = /data01/mysql/log/mysql-relay-bin
    log-slave-updates = 1
    {% end %}\
    sync-binlog = 1
    #read-only = 1
    #report-host = <server fqdn>

    # [snip]