- How to upgrade xenon without affecting MySQL service
- Cluster information
- Step1. Stop the xenon process for all nodes
- Step2. Remove peers.json for all nodes
- Step3. Upgrade xenon
- Step4. Start xenon on xenon-1
- Step5. Start xenon on xenon-2
- Step6. Add peers for xenon-1
- Step7. Add peers for xenon-2
- Step8. Start xenon on xenon-3
- Step9. Add peers for xenon-1 and xenon-2
- Step10. Add peers for xenon-3
- Step11. Check cluster status
Assume:
- Cluster has 3 nodes :
xenon-1: 192.168.0.2:8801 LEADER
xenon-2: 192.168.0.3:8801 FOLLOWER
xenon-3: 192.168.0.4:8801 FOLLOWER
- The relevant paths:
# The directory of the xenon binary
export XENON_BIN=/opt/xenon
# The path of the config file
export XENON_CONF=/etc/xenon/xenon.json
# The path of the peers file
export XENON_PEERS=/data/raft/peers.json
# The path of the log file
export XENON_LOG=/data/log/xenon.log
Executing follow command on xenon-1
:
# avoid leader degrade and remove vip during command execution
pkill -9 xenon && ssh 192.168.0.3 "pkill -9 xenon" && ssh 192.168.0.4 "pkill -9 xenon"
Executing follow command on all nodes:
rm ${XENON_PEERS} -f
Replace the latest xenon
and xenoncli
for all nodes.
Executing follow command on xenon-1
:
#
${XENON_BIN}/xenon -c ${XENON_CONF} -r LEADER >> ${XENON_LOG} 2>&1 &
Executing follow command on xenon-2
:
${XENON_BIN}/xenon -c ${XENON_CONF} >> ${XENON_LOG} 2>&1 &
Executing follow command on xenon-1
:
${XENON_BIN}/xenoncli cluster add 192.168.0.3:8801
Executing follow command on xenon-2
:
${XENON_BIN}/xenoncli cluster add 192.168.0.2:8801
Executing follow command on xenon-3
:
${XENON_BIN}/xenon -c ${XENON_CONF} >> ${XENON_LOG} 2>&1 &
Executing follow command on xenon-1
(LEADER):
${XENON_BIN}/xenoncli cluster add 192.168.0.4:8801
Executing follow command on xenon-3
:
${XENON_BIN}/xenoncli cluster add 192.168.0.2:8801,192.168.0.3:8801
${XENON_BIN}/xenoncli cluster status
Output:
+-------------------+--------------------------------+---------+---------+--------------------------+---------------------+----------------+------------------+
| ID | Raft | Mysqld | Monitor | Backup | Mysql | IO/SQL_RUNNING | MyLeader |
+-------------------+--------------------------------+---------+---------+--------------------------+---------------------+----------------+------------------+
| 192.168.0.2:8801 | [ViewID:1 EpochID:2]@LEADER | RUNNING | ON | state:[NONE] | [ALIVE] [READWRITE] | [true/true] | 192.168.0.2:8801 |
| | | | | LastError: | | | |
+-------------------+--------------------------------+---------+---------+--------------------------+---------------------+----------------+------------------+
| 192.168.0.3:8801 | [ViewID:1 EpochID:2]@FOLLOWER | RUNNING | ON | state:[NONE] | [ALIVE] [READONLY] | [true/true] | 192.168.0.2:8801 |
| | | | | LastError: | | | |
+-------------------+--------------------------------+---------+---------+--------------------------+---------------------+----------------+------------------+
| 192.168.0.4:8801 | [ViewID:1 EpochID:2]@FOLLOWER | RUNNING | ON | state:[NONE] | [ALIVE] [READONLY] | [true/true] | 192.168.0.2:8801 |
| | | | | LastError: | | | |
+-------------------+--------------------------------+---------+---------+--------------------------+---------------------+----------------+------------------+