Task
How to repair/set persistent storage from (VM and across reboots), set hostname, and enable the stream plugin when RabbitMQ has been migrated to container.
Lab Scenario:
- K8s Namespace/OKD Project: mw-rabbitmq
- App name: mw-rabbitmq
- Pod name: mw-rabbitmq-abcd-1
- Container name: rabbitmq
Notes:
- The HOSTNAME environmental variable must be set if not Statefulset is not an option or not setup.
- The rabbitmq pod must be at Running status before enabling the streaming plugin.
Steps:
1. Verify built/deployed with its environmental arguments:
(either through buildconfig or the app deployment if did not use bc)
a. Check deployment/buildconfig:
$ oc project mw-rabbitmq
<confirm using this project/namespace>
$ oc describe deployment/mw-rabbitmq
or
$ oc describe bc bc/mw-rabbitmq
...
env:
- name: RABBITMQ_SERVER_ADDITIONAL_ERL_ARGS
value: "-rabbitmq_stream advertised_host localhost"
- name: HOSTNAME
value: "mq.mindwatering.net"
- name: RABBITMQ_MNESIA_DIR
value: /pv/folder/path
...
b. If any environmental variables missing, add to deployment or bc by editing its YAML or via commands:
(Example below is for deployment/<appname> instead of bc/<appname>)
$ oc set env deployment/mw-rabbitmq RABBITMQ_MNESIA_DIR=/pv/folder/path
<confirm>
$ oc set env deployment/mw-rabbitmq HOSTNAME=mq.mindwatering.net
<confirm>
$ oc set env deployment/mw-rabbitmq RABBITMQ_SERVER_ADDITIONAL_ERL_ARGS="-rabbitmq_stream advertised_host localhost"
<confirm>
c. If variables were updated, the storage and hostname were probably not mapping correctly so no loss, restart the deployment:
$ oc rollout restart deployments/mw-rabbitmq
2. Verify pod running:
$ oc project mw-rabbitmq
<confirm pod at running state and note pod name (e.g. rabbitmq-abcd-1 )
3. Enable the stream and stream management plugins:
Note:
- The oc exec command will not work on privileged containers unless the command executed by a user with the cluster-admin role.
- Syntax: oc exec <podname> <command> ....
$ oc exec rabbitmq-abcd-1 rabbitmq-plugins enable rabbitmq_stream rabbitmq_stream_management
<confirm output>
previous page
|