salt/doc/topics/tutorials/multimaster.rst

114 lines
3.9 KiB
ReStructuredText
Raw Normal View History

2013-06-18 07:34:19 +00:00
=====================
Multi Master Tutorial
=====================
2013-06-18 22:01:57 +00:00
As of Salt 0.16.0, the ability to connect minions to multiple masters has been
2013-06-18 07:34:19 +00:00
made available. The multi-master system allows for redundancy of Salt
masters and facilitates multiple points of communication out to minions. When
2013-06-18 22:01:57 +00:00
using a multi-master setup, all masters are running hot, and any active master
2013-06-18 07:34:19 +00:00
can be used to send commands out to the minions.
In 0.16.0, the masters do not share any information, keys need to be accepted
on both masters, and shared files need to be shared manually or use tools like
the git fileserver backend to ensure that the :conf_master:`file_roots` are
kept consistent.
2013-06-18 07:34:19 +00:00
Summary of Steps
----------------
1. Create a redundant master server
2. Copy primary master key to redundant master
3. Start redundant master
4. Configure minions to connect to redundant master
5. Restart minions
6. Accept keys on redundant master
Prepping a Redundant Master
---------------------------
2013-06-18 22:01:57 +00:00
The first task is to prepare the redundant master. There is only one
2013-06-18 07:34:19 +00:00
requirement when preparing a redundant master, which is that masters share the
2013-06-18 22:01:57 +00:00
same private key. When the first master was created, the master's identifying
key was generated and placed in the master's ``pki_dir``. The default location
of the key is ``/etc/salt/pki/master/master.pem``. Take this key and copy it to
2013-06-18 07:34:19 +00:00
the same location on the redundant master. Assuming that no minions have yet
2013-06-18 22:01:57 +00:00
been connected to the new redundant master, it is safe to delete any existing
2013-06-18 07:34:19 +00:00
key in this location and replace it.
.. note::
There is no logical limit to the number of redundant masters that can be
used.
2013-06-18 22:01:57 +00:00
Once the new key is in place, the redundant master can be safely started.
2013-06-18 07:34:19 +00:00
Configure Minions
-----------------
2013-06-18 22:01:57 +00:00
Since minions need to be master-aware, the new master needs to be added to the
minion configurations. Simply update the minion configurations to list all
2013-06-18 07:34:19 +00:00
connected masters:
.. code-block:: yaml
master:
- saltmaster1.example.com
- saltmaster2.example.com
Now the minion can be safely restarted.
Now the minions will check into the original master and also check into the new
2013-06-18 22:01:57 +00:00
redundant master. Both masters are first-class and have rights to the minions.
2013-06-18 07:34:19 +00:00
Sharing Files Between Masters
-----------------------------
Salt does not automatically share files between multiple masters. A number of
files should be shared or sharing of these files should be strongly considered.
Minion Keys
```````````
Minion keys can be accepted the normal way using :strong:`salt-key` on both
masters. Keys accepted, deleted, or rejected on one master will NOT be
automatically managed on redundant masters; this needs to be taken care of by
running salt-key on both masters or sharing the
``/etc/salt/pki/master/{minions,minions_pre,minions_rejected}`` directories
2013-06-18 07:34:19 +00:00
between masters.
.. note::
While sharing the :strong:`/etc/salt/pki/master` directory will work, it is
strongly discouraged, since allowing access to the :strong:`master.pem` key
outside of Salt creates a *SERIOUS* security risk.
2013-06-18 07:34:19 +00:00
File_Roots
``````````
The :conf_master:`file_roots` contents should be kept consistent between
masters. Otherwise state runs will not always be consistent on minions since
instructions managed by one master will not agree with other masters.
2013-06-18 07:34:19 +00:00
The recommended way to sync these is to use a fileserver backend like gitfs or
to keep these files on shared storage.
Pillar_Roots
````````````
Pillar roots should be given the same considerations as
:conf_master:`file_roots`.
2013-06-18 07:34:19 +00:00
Master Configurations
`````````````````````
While reasons may exist to maintain separate master configurations, it is wise
2013-06-18 22:01:57 +00:00
to remember that each master maintains independent control over minions.
Therefore, access controls should be in sync between masters unless a valid
2013-06-18 07:34:19 +00:00
reason otherwise exists to keep them inconsistent.
These access control options include but are not limited to:
- external_auth
- client_acl
- peer
- peer_run