Here are the steps we follow to create a replica set in podman. We use a
pod to hold all the mongo instances, which is a concept not likely present
in docker:
1. Create a pod
podman pod create --name mongo-replica-set -p 30001 -p 30002 -p 30003
2. Create 3 mongo containers in the pod (the minimum required for a replica
set).
Each container will expose a different port for mongo (30001-3)
podman run -d --pod mongo-replica-set --name mongo1 mongo:3.6 mongod
--port 30001 --replSet mongo-repl-set
podman run -d --pod mongo-replica-set --name mongo2 mongo:3.6 mongod
--port 30002 --replSet mongo-repl-set
podman run -d --pod mongo-replica-set --name mongo3 mongo:3.6 mongod
--port 30003 --replSet mongo-repl-set
3. To verify the previous step, connect to mongo on one of the specified
ports (this assumes you have a local installation of the mongo client)
mongo --port 30001
4. Once connected, create a connection to a database (in this case, the
'test' database but it may be the 'pantheondb' one which is what's used in
production)
> db = (new Mongo('localhost:30001')).getDB('test')
5. To tie all three containers in a replica set, create a configuration in
the form of a json object (this is still happening in the mongo shell)
> config = {
"_id" : "mongo-repl-set",
"members" : [
{
"_id" : 0,
"host" : "localhost:30001"
},
{
"_id" : 1,
"host" : "localhost:30002"
},
{
"_id" : 2,
"host" : "localhost:30003"
}]
}
6. Use the configuration object to initialize the replica set
> rs.initiate(config)
You should see a confirmation message of this type:
{
{ "ok" : 1,
"operationTime" : Timestamp(1581368609, 1),
"$clusterTime" : {
"clusterTime" : Timestamp(1581368609, 1),
"signature" : {
"hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="),
"keyId" : NumberLong(0)
}
}
}
}
All members of the replica set should now be available via localhost:port
either from within the pod, or exposed to the local machine via the pod
created in step 1.
Is there a reason why the Jcr repository could be restarting? And what
class could we start looking into to debug if this is the case? I have
unsuccessfully tried to increase the logging level in Sling but nothing
I've done has worked.
Carlos
On Tue, Feb 11, 2020 at 4:43 AM Robert Munteanu <[email protected]> wrote:
> On Mon, 2020-02-10 at 17:16 -0500, Carlos Munoz wrote:
> > Thanks Sergiu, I will give that a shot (removing that configuration
> > item I
> > mean).
> >
> > I actually managed to replicate some of the weird symptoms locally.
> > It
> > required me to set up a local mongo replica set. (I used podman, so
> > let me
> > know if you need the steps I followed to do this). The first time I
> > ran
> > sling against my local database it worked, but after running the
> > second
> > time it froze up before our bundle could even come up.
>
> Steps to reproduce are always great :-)
>
> I don't have podman installed, but IIRC commands podman and docker CLI
> commands should be compatible, so feel free to add those.
>
> >
> > I did see a lot of entries like these, where it seems to registering
> > and
> > subsequently unregistering the same service(s) multiple times:
>
> (snip)
>
> Sounds like something low-level is restarting, causing lots of other
> services to restart. Maybe the repository itself?
>
> Robert
>
>