# Running non-sharding setup with only 1 replica

**URL:** <https://forums.percona.com/t/running-non-sharding-setup-with-only-1-replica/34100>\
**Category:** Percona Operator for MongoDB\
**Created:** [October 3, 2024, 2:39pm UTC](https://forums.percona.com/t/running-non-sharding-setup-with-only-1-replica/34100 "2024-10-03T14:39:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jamoser](https://avatars.discourse-cdn.com/v4/letter/j/b2d939/32.png) [@jamoser](https://forums.percona.com/u/jamoser)\
**Post date:** [October 3, 2024, 2:39pm UTC](https://forums.percona.com/t/running-non-sharding-setup-with-only-1-replica/34100/1 "2024-10-03T14:39:29Z")

</div>

Hello

May be I missed that but is it possible to run the “non-sharding” setup with only one replica ?

[edit] … and what is the absolute minimum, so that a cluster is responsive, even if a replica would be down (for ex due to GKE nightly maintenance) ?

Regards  
John

---

<div class="post-metadata">

**Author:** ![Vinodh\_Krishnaswamy](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/vinodh_krishnaswamy/32/46_2.png) [@Vinodh\_Krishnaswamy](https://forums.percona.com/u/Vinodh_Krishnaswamy)\
**Post date:** [October 3, 2024, 6:22pm UTC](https://forums.percona.com/t/running-non-sharding-setup-with-only-1-replica/34100/2 "2024-10-03T18:22:15Z")

</div>

hey John,

> May be I missed that but is it possible to run the “non-sharding” setup with only one replica ?

Did you mean single-member replicaSet? Then yes. For the normal setup, to convert a standalone, you will need to add the below configuration to mongod.conf file and restart:

```auto
replication:
  replSetName: "rs0"

```

Then initiate the replicaset as follows:

```auto
rs.initiate()

```

.  
For the psmdb operator, keep `spec.sharding.enabled: false` and `spec.replsets.size: 1` in cr.yaml. See [here](https://docs.percona.com/percona-operator-for-mongodb/operator.html#replsetssize) and [here](https://docs.percona.com/percona-operator-for-mongodb/sharding.html#turning-sharding-on-and-off).  
From my test:

```auto
$ kubectl get pods -n psmdb 
NAME READY STATUS RESTARTS AGE
my-cluster-name-rs0-0 2/2 Running 5 (24h ago) 33h
percona-server-mongodb-operator-85779f9cd7-6xklq 1/1 Running 6 (24h ago) 6d23h

```

From the values of cr.yaml:

```auto
$ kubectl get psmdb -n psmdb -o=jsonpath='{.items[0].spec.replsets[].size}' 
1
$ kubectl get psmdb -n psmdb -o=jsonpath='{.items[0].spec.sharding.enabled}' 
false

```

.

> [edit] … and what is the absolute minimum, so that a cluster is responsive, even if a replica would be down (for ex due to GKE nightly maintenance) ?

Can you explain this clearly? In the above statement, you mentioned non-sharding and here you are asking about the sharded cluster stability when a replica is down. If you are asking about fault tolerance of a replicaset, then refer [here](https://www.mongodb.com/docs/v7.0/core/replica-set-architectures/#strategies). Else if you could explain the architecture and your end goal clearly, then we may try to help you with that direction.

Regards,  
Vinodh Guruji

---

<div class="post-metadata">

**Author:** ![Sergey\_Pronin](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/sergey_pronin/32/14887_2.png) [@Sergey\_Pronin](https://forums.percona.com/u/Sergey_Pronin)\
**Post date:** [October 4, 2024, 1:06pm UTC](https://forums.percona.com/t/running-non-sharding-setup-with-only-1-replica/34100/3 "2024-10-04T13:06:36Z")

</div>

To add more to what @Vinodh_Krishnaswamy said, you might also need to disable unsafe flag (if you use old version, otherwise operator will scale it up to 3 automatically).

Read more about unsafe flag here: [Custom Resource options - Percona Operator for MongoDB](https://docs.percona.com/percona-operator-for-mongodb/operator.html#unsafe-flags-section)

Also feel free to book me here: [Zoom Scheduler](https://scheduler.zoom.us/percona-sergey-pronin/ivee-and-product)  
if you want to chat about it and open to share your use cases 🙂
