RHEL 8/9로 마이그레이션
새 RHEL 8/9 시스템용 Salt 인프라를 생성하고 준비한 후에는 다음 마이그레이션 단계를 수행하여 RHEL 8/9로의 업그레이드를 완료할 수 있습니다.
마이그레이션 준비 및 수행
- RHEL 7 및 RHEL 8/9 시스템 모두에서 RaaS 서비스를 중지합니다.
- 이전 서버에서 새 서버로 gz 백업 파일을 복사합니다. gz 파일은 ownership=postgres:postgres로/var/lib/pgsql디렉토리에 저장해야 합니다.
- postgres 사용자에서 다음 명령을 실행하여 데이터베이스 디렉토리를 제거합니다.su - postgres psql -U postgres drop database raas_43cab1f4de604ab185b51d883c5c5d09
- 빈 데이터베이스를 생성하고 사용자를 확인합니다.create database raas_43cab1f4de604ab185b51d883c5c5d09 \du – should display users for postgres and salteapi
- /etc/raas/pki/.raas.key및/etc/raas/pki/.instance_id파일을 이전 RaaS 서버에서 새 RaaS 서버로 복사합니다.
- 새 Postgresql 데이터베이스에 대한 업그레이드 명령을 실행합니다.su – raas raas -l debug upgrade
Automation Config
UI에 액세스할 수도 있습니다. 다음으로 새 RHEL 8/9 Salt 마스터에서 마스터 플러그인을 구성해야 합니다.새 Salt 마스터에서 마스터 플러그인 구성
새 rhel9-master 노드에서 다음 단계를 수행합니다.
- Log in to your Salt master and verify the/etc/salt/master.ddirectory exists, or create it.
- Generate the master configuration settings.If you want to preserve your settings when upgrading your installation, make a backup of your existing Master Plugin configuration file before running this step. Then copy relevant settings from your existing configuration to the newly generated file.sudo sseapi-config --all > /etc/salt/master.d/raas.confIf you installed Salt using onedir, the path to this executable is/opt/saltstack/salt/extras-3.10/bin/sseapi-config.
- Edit the generatedraas.conffile and update the values as follows:ValueDescriptionsseapi_ssl_validate_certValidates the certificate the API (RaaS) uses. The default isTrue.If you are using your own CA-issued certificates, set this value toTrueand configure thesseapi_ssl_ca,sseapi_ssl_cert, andsseapi_ssl_cert:settings.Otherwise, set this toFalseto not validate the certificate.sseapi_ssl_validate_cert:Falsesseapi_serverHTTP IP address of your RaaS node, for example,http://example.com, orhttps://example.comif SSL is enabled.sseapi_command_age_limitSets the age (in seconds) after which old, potentially stale jobs are skipped. For example, to skip jobs older than a day, set it to:sseapi_command_age_limit:86400Skipped jobs continue to exist in the database and display with a status ofCompletedin theAutomation Configuser interface.Some environments might need the Salt master to be offline for long periods of time and will need the Salt master to run any jobs that were queued after it comes back online. If this applies to your environment, set the age limit to0.sseapi_windows_minion_deploy_delaySets a delay to allow all requisite Windows services to become active. The default value is 180 seconds.sseapi_linux_minion_deploy_delaySets a delay to allow all requisite Linux services to become activate. The default value is 90 seconds.sseapi_local_cache load: 3600 tgt: 86400 pillar: 3600 exprmatch: 86400 tgtmatch: 86400Sets the length of time that certain data is cached locally on each salt master. Values are in seconds. The example values are recommended values.
- load- salt save_load() payloads
- tgt- SSE target groups
- pillar- SSE pillar data (encrypted)
- exprmatch- SSE target expression matching data
- tgtmatch- SSE target group matching data
- OPTIONAL:This step is necessary for manual installations only. To verify you can connect to SSL before connecting the Master Plugin, edit the generatedraas.conffile to update the following values. If you do not update these values, the Master Plugin uses the default generated certificate.ValueDescriptionsseapi_ssl_caThe path to a CA file.sseapi_ssl_certThe path to the certificate. The default value is/etc/pki/raas/certs/localhost.crt.sseapi_ssl_keyThe path to the certificate’s private key. The default value is/etc/pki/raas/certs/localhost.key.idComment this line out by adding a#at the beginning. It is not required.
- OPTIONAL:Update performance-related settings. For large or busy environments, you can improve the performance of the communications between the Salt master andAutomation Configby adjusting the following settings.
- Configure the master plugin engines:The master plugineventqueueandrpcqueueengines offload some communications withAutomation Configfrom performance-critical code paths to dedicated processes. While the engines are waiting to communicate withAutomation Config, payloads are stored in the Salt master’s local filesystem so the data can persist across restarts of the Salt master. Thetgtmatchengine moves the calculation of minion target group matches from the RaaS server to the salt-masters.To enable the engines, ensure that the following settings are present in the Salt Master Plugin configuration file (raas.conf):engines: - sseapi: {} - eventqueue: {} - rpcqueue: {} - jobcompletion: {} - tgtmatch: {}To configure theeventqueueengine, verify that the following settings are present:sseapi_event_queue: name: sseapi-events strategy: always push_interval: 5 batch_limit: 2000 age_limit: 86400 size_limit: 35000000 vacuum_interval: 86400 vacuum_limit: 350000The queue parameters can be adjusted with consideration to how they work together. For example, assuming an average of 400 events per second on the Salt event bus, the settings shown above allow for about 24 hours of queued event traffic to collect on the Salt master before the oldest events are discarded due to size or age limits.To configure therpcqueueengine, verify the following settings in raas.conf:sseapi_rpc_queue: name: sseapi-rpc strategy: always push_interval: 5 batch_limit: 500 age_limit: 3600 size_limit: 360000 vacuum_interval: 86400 vacuum_limit: 100000tgtmatch 엔진을 구성하려면 이러한 설정이 마스터 플러그인 구성 파일(/etc/salt/master.d/raas.conf)에 있는지 확인합니다.engines: - sseapi: {} - eventqueue: {} - rpcqueue: {} - jobcompletion: {} - tgtmatch: {} sseapi_local_cache: load: 3600 tgt: 86400 pillar: 3600 exprmatch: 86400 tgtmatch: 86400 sseapi_tgt_match: poll_interval: 60 workers: 0 nice: 19To make use of target matching on the salt-masters, the following config setting must also be present in the RaaS configuration:target_groups_from_master_only: true.
- Limit minion grains payload sizes:sseapi_max_minion_grains_payload: 2000
- Enable skipping jobs that are older than a defined time (in seconds). For example, use86400to set it to skip jobs older than a day. When set to0, this feature is disabled:sseapi_command_age_limit:0During system upgrades, enabling this setting is useful to prevent old commands stored in the database from running unexpectedly.
Together, event queuing in Salt and the queuing engines, salt-master target matching, grains payload size limit, and command age limit in the Salt Master Plugin increase the throughput and reduce the latency of communications between the Salt master andAutomation Configin the most performance-sensitive code paths. - Restart the master service.sudo systemctl restart salt-master
- OPTIONAL:You might want to run a test job to ensure the Master Plugin is now enabling communication between the master and the RaaS node.salt -v '*' test.ping
이제 RHEL 8/9 마스터가
마스터 키
페이지에 나타납니다. 이 시점에서 마스터 키를 수락하지 마십시오.
미니언 에이전트 구성
다음 단계에 따라 rhel9-master 노드의 미니언 에이전트가 자신을 가리키도록 구성합니다.
- SSH를 통해 rhel9-master 노드에 연결하고/etc/salt/minion.d디렉토리로 이동합니다.
- minion.conf파일을 편집하고 마스터 설정을master:localhost로 변경합니다.
- /etc/salt/pki/minion디렉토리로 이동하여minion_master.pub파일을 삭제합니다.
- 다음을 사용하여 salt-minion 서비스를 다시 시작합니다.systemctl restart salt-minion
- 다음을 실행하여 rhel9-master에서 미니언 키를 보고 수락합니다.salt-key salt-key -A
- Automation Config에서 로 이동한 후 마스터 키를 수락합니다.이제 RHEL8/9 마스터가대상페이지에 나타납니다.
- SSH를 통해 RHEL7 마스터에 연결하고 rhel9-master 미니언에 대한 키를 삭제합니다.
Salt-Minion 시스템 마이그레이션
관리되는 시스템을 마이그레이션하는 방법에는 여러 가지가 있습니다. 프로세스가 이미 설정되어 있는 경우 해당 프로세스를 따르십시오. 그렇지 않은 경우 다음 지침을 사용하여 salt-minion을 이전 Salt 마스터에서 새 Salt 마스터로 마이그레이션합니다.
이 단계는 다중 마스터 시스템에는 적용되지 않습니다.
- 오케스트레이션 파일을 생성합니다. 예를 들어,# Orchestration to move Minions from one master to another # file: /srv/salt/switch_masters/init.sls {% import_yaml 'switch_masters/map.yaml' as mm %} {% set minions = mm['minionids'] %} {% if minions %} {% for minion in minions %} move_minions_{{ minion }}: salt.state: - tgt: {{ minion }} - sls: - switch_masters.move_minions_map {% endfor %} {% else %} no_minions: test.configurable_test_state: - name: No minions to move - result: True - changes: False - comment: No minions to move {% endif %} remove_minions: salt.runner: - name: manage.down - removekeys: True # map file for moving minions # file: /srv/salt/switch_masters/map.yaml newsaltmaster: <new_ip_address> oldsaltmaster: <old_ip_address> minionids: - minion01 - minion02 - minion03 state to switch minions from one master to another # file: /srv/salt/swith_masters/move_minions_map.sls {% set minion = salt['grains.get']('os') %} # name old master and set new master ip address {% import_yaml 'switch_masters/map.yaml' as mm %} {% set oldmaster = mm['oldsaltmaster'] %} {% set newmaster = mm['newsaltmaster'] %} # remove minion_master.pub key {% if minion == 'Windows' %} remove_master_key: file.absent: - name: c:\ProgramData\Salt Project\Salt\conf\pki\minion\minion_master.pub change_master_assignment: file.replace: - name: c:\ProgramData\Salt Project\Salt\conf\minion.d\minion.conf - pattern: 'master: {{oldmaster}}' - repl: 'master: {{newmaster}}' - require: - remove_master_key {% else %} remove_master_key: file.absent: - name: /etc/salt/pki/minion/minion_master.pub # modify minion config file change_master_assignment: file.replace: - name: /etc/salt/minion.d/minion.conf - pattern: 'master: {{oldmaster}}' - repl: 'master: {{newmaster}}' - require: - remove_master_key {% endif %} # restart salt-minion restart_salt_minion: service.running: - name: salt-minion - require: - change_master_assignment - watch: - change_master_assignment
- 다음을 포함하는map.yaml파일을 생성합니다(위 코드 예 참조).
- <old salt master> IP 주소/FQDN
- <new salt master> IP 주소/FQDN
- 이동할 saltminionID 목록
- 마이그레이션을 처리할 상태 파일(위 코드 예 참조)을 생성합니다. 예:move_minions_map.sls.
- 이러한 파일을 디렉토리(예: RHEL7 Salt 마스터의/srv/salt/switch_masters)에 추가합니다.
- RHEL7 Salt 마스터에서 오케스트레이션 파일을 실행합니다. 이로 인해 오류가 발생합니다. Salt 미니언 서비스가 다시 시작되고 RHEL7 Salt 마스터에 대해 온라인 상태가 되지 않기 때문입니다.
- Automation Config에서 진행 상황을 모니터링합니다. Salt 미니언 ID가 UI에 채워지면 Salt 미니언 ID 마이그레이션을 수락합니다.
- 모든 시스템이 마이그레이션된 후 시스템에 대해test.ping작업을 실행하여 모든 시스템이 제대로 통신하고 있는지 확인합니다.
기존 파일 마이그레이션
이 프로세스는 조직이 상태 및 구성 파일을 생성, 저장 및 관리하는 방식에 전적으로 의존합니다. 가장 일반적인 사용 사례가 참조용으로 아래에 설명되어 있습니다.
사용 사례 1:
Automation Config
파일 서버이 사용 사례에서는
Automation Config
파일이 Postgres 데이터베이스에 저장되고 Automation Config
UI에 나타납니다.Postgres 데이터베이스 복원 중에 이러한 파일이 복구 및 마이그레이션됩니다. 이러한 파일을 RHEL8/9 환경으로 마이그레이션하기 위해 수행해야 하는 추가 단계는 없습니다.
사용 사례 2: Github/Gitlab 파일 서버
이 사용 사례에서는
Automation Config
상태 및 구성 파일이 Github/Gitlab/Bitbucket 또는 다른 코드 버전 제어 시스템에 저장됩니다.이러한 파일은 타사 도구에 저장되므로 저장소 시스템에 연결하려면 새 RHEL8/9 마스터를 구성해야 합니다. 이 구성은 RHEL7 저장소 구성을 미러링합니다.
사용 사례 3: Salt 마스터의 로컬 파일 루트
이 사용 사례에서는
Automation Config
가 Salt 마스터의 로컬 파일 서버 디렉토리에 저장됩니다.이러한 파일을 RHEL8/9 마스터로 마이그레이션하려면 RHEL7 마스터에서 RHEL8/9 마스터로 적절한 디렉토리를 복사합니다.
- 파일은 상태 파일 및 pillar 파일에 대해 각각/srv/salt및/srv/pillar에 저장됩니다.
- winscp 또는 명령줄과 같은 보안 복사 도구를 사용하여 RHEL7 마스터에서 RHEL8/9 마스터로 이러한 디렉토리의 보안 복사를 수행합니다.
- Salt \* saltutil.refresh_pillar를 사용하여 pillar 날짜를 새로 고칩니다.