On juju 2.9, I tried to reproduce this and it seemed to work - and rs.confg() and rs.status() confimed it. After enable-ha, I first tested removing machine 1 (a secondary).
Then I removed machine 0, the primary. In this case, the api server does drop (so my debug-log session terminated and my open mongo client connection because invalid). But after a short time (yes, it takes a few seconds), the replicaset was repaired and was configured as expected
On juju 2.9, I tried to reproduce this and it seemed to work - and rs.confg() and rs.status() confimed it. After enable-ha, I first tested removing machine 1 (a secondary).
Maybe it's an issue introduced in 3.2.
So we had
0: primary
2: secondary, non voting
Then enable-ha created a replacement node
0: primary
2: secondary, voting
3: secondary, voting
Then I removed machine 0, the primary. In this case, the api server does drop (so my debug-log session terminated and my open mongo client connection because invalid). But after a short time (yes, it takes a few seconds), the replicaset was repaired and was configured as expected
2: primary
3: secondary, non voting
Opening a mongo client connection to machine 2:
"protocolVersi on" : NumberLong(1),
"writeConcernM ajorityJournalD efault" : true,
"_id" : 3,
"host" : "10.240.0.9:37017",
"arbiterOnly " : false,
"buildIndexe s" : true,
"hidden" : false,
"priority" : 1,
"tags" : {
"juju- machine- id" : "2"
},
"slaveDelay" : NumberLong(0),
"votes" : 1
"_id" : 4,
"host" : "10.240. 0.13:37017" ,
"arbiterOnly " : false,
"buildIndexe s" : true,
"hidden" : false,
"priority" : 0,
"tags" : {
"juju- machine- id" : "3"
},
"slaveDelay" : NumberLong(0),
"votes" : 0 "2023-04- 20T01:36: 23.784Z" ),
"_id" : 3,
"name" : "10.240.0.9:37017",
"health" : 1,
"state" : 1,
"stateStr" : "PRIMARY",
"_id" : 4,
"name" : "10.240. 0.13:37017" ,
"health" : 1,
"state" : 2,
"stateStr" : "SECONDARY",
juju:PRIMARY> rs.config()
{
"_id" : "juju",
"version" : 9,
"term" : 3,
"members" : [
{
},
{
}
],
}
juju:PRIMARY> rs.status()
{
"set" : "juju",
"date" : ISODate(
"myState" : 1,
"term" : NumberLong(3),
"members" : [
{
},
{
}
],
"ok" : 1,
}
And I can use enable-ha to set up the full replicaset again
2: primary
3: secondary, voting
4: secondary, voting
(rs config and status are as expected)