# Mongod configuration

**URL:** https://forums.percona.com/t/mongod-configuration/29286
**Category:** Percona Operator for MongoDB
**Created:** [March 21, 2024, 4:05pm UTC](https://forums.percona.com/t/mongod-configuration/29286 "2024-03-21T16:05:29Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Sergey\_Zelenov1](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/sergey_zelenov1/32/15747_2.png) [@Sergey\_Zelenov1](https://forums.percona.com/u/Sergey_Zelenov1)
#### Post date: [March 21, 2024, 4:05pm UTC](https://forums.percona.com/t/mongod-configuration/29286/1 "2024-03-21T16:05:30Z")

</div>

## Description:

It seems that custom configuration they can be passed through the replset.configuration ([Custom Resource options - Percona Operator for MongoDB](https://docs.percona.com/percona-operator-for-mongodb/operator.html#replsets-section)) is not really applied to mongod process.

## Steps to Reproduce:

I have the following helm configuration file:

```yaml
psmdb-db:
  secrets:
    users: mongodb-secrets
  replsets:
    - name: rs0
      size: 3
      configuration: |
        systemLog:
          quiet: true
        replication:
          oplogSizeMB: 15360
    ....

```

After the deployment I see that this also exists in custom resource:

```auto
$ kubectl -n mongodb get perconaservermongodb mongodb-psmdb-db -o yaml
...
replsets:
  - affinity: {}
    configuration: |
      systemLog:
        quiet: true
      replication:
        oplogSizeMB: 15360
    name: rs0
    nodeSelector:
...

```

but the stateful set doesn’t have this option:

```auto
$ kubectl get statefulset mongodb-psmdb-db-rs0 -n mongodb -o yaml

...
containers:
      - args:
        - --bind_ip_all
        - --auth
        - --dbpath=/data/db
        - --port=27017
        - --replSet=rs0
        - --storageEngine=wiredTiger
        - --relaxPermChecks
        - --sslAllowInvalidCertificates
        - --clusterAuthMode=x509
        - --shardsvr
        - --enableEncryption
        - --encryptionKeyFile=/etc/mongodb-encryption/encryption-key
        - --wiredTigerCacheSizeGB=5.55
        - --wiredTigerIndexPrefixCompression=true
        - --config=/etc/mongodb-config/mongod.conf
        command:
        - /opt/percona/ps-entry.sh
        env:
        - name: SERVICE_NAME
          value: mongodb-psmdb-db
        - name: NAMESPACE
          value: mongodb
        - name: MONGODB_PORT
          value: "27017"
        - name: MONGODB_REPLSET
          value: rs0
        envFrom:
        - secretRef:
            name: internal-mongodb-psmdb-db-users
            optional: false
        image: percona/percona-server-mongodb:6.0.9-7
        imagePullPolicy: Always
...

```

and the exact oplog size is 5GB:

```auto
rs0 [direct: primary] local> rs.printReplicationInfo()
actual oplog size
'5064.4248046875 MB'
---
configured oplog size
'5064.4248046875 MB'
---

```

I’m not very familiar with the operator code, but it seems that at the moment it only parses couple of arguments.

## Version:

[Insert the version number of the software]

- name: psmdb-operator  
version: 1.15.0  
repository: percona-helm-charts
- name: psmdb-db  
version: 1.15.0  
repository: percona-helm-charts

## Logs:

[If applicable, include any relevant log files or error messages]

## Expected Result:

[What the user expected to see or happen before the issue occurred]  
Expect oplog parameter passed to mongod:

```auto
--oplogSizeMB=...

```

## Actual Result:

[What actually happened when the user encountered the issue]  
No such parameter (also syslog is missing)

## Additional Information:

[Include any additional information that could be helpful to diagnose the issue, such as browser or device information]

---

<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: [March 21, 2024, 7:57pm UTC](https://forums.percona.com/t/mongod-configuration/29286/2 "2024-03-21T19:57:42Z")

</div>

Hello @Sergey_Zelenov1 ,

as you can see there is this flag:

```auto
        - --config=/etc/mongodb-config/mongod.conf

```

This is where the configuration is stored.  
If you exec into the container, you would see the file has these parameters and they are actually applied.

This is in my container:

```auto
$ cat /etc/mongodb-config/mongod.conf 
systemLog:
  quiet: true
replication:
  oplogSizeMB: 500

```

As for rs.printReplicationInfo() and the size not changing, have you tried to run replSetResizeOplog? As per mongodb docs:

> Once the [`mongod`](https://www.mongodb.com/docs/manual/reference/program/mongod/#mongodb-binary-bin.mongod) has created the oplog for the first time, changing the [`replication.oplogSizeMB`](https://www.mongodb.com/docs/manual/reference/configuration-options/#mongodb-setting-replication.oplogSizeMB) option will not affect the size of the oplog. To change the maximum oplog size after starting the [`mongod`](https://www.mongodb.com/docs/manual/reference/program/mongod/#mongodb-binary-bin.mongod), use [`replSetResizeOplog`](https://www.mongodb.com/docs/manual/reference/command/replSetResizeOplog/#mongodb-dbcommand-dbcmd.replSetResizeOplog). [`replSetResizeOplog`](https://www.mongodb.com/docs/manual/reference/command/replSetResizeOplog/#mongodb-dbcommand-dbcmd.replSetResizeOplog) enables you to resize the oplog dynamically without restarting the [`mongod`](https://www.mongodb.com/docs/manual/reference/program/mongod/#mongodb-binary-bin.mongod) process. To persist the changes made using [`replSetResizeOplog`](https://www.mongodb.com/docs/manual/reference/command/replSetResizeOplog/#mongodb-dbcommand-dbcmd.replSetResizeOplog) through a restart, update the value of [`oplogSizeMB`.](https://www.mongodb.com/docs/manual/reference/configuration-options/#mongodb-setting-replication.oplogSizeMB)

---

<div class="post-metadata">

### Author: ![Sergey\_Zelenov1](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/sergey_zelenov1/32/15747_2.png) [@Sergey\_Zelenov1](https://forums.percona.com/u/Sergey_Zelenov1)
#### Post date: [March 22, 2024, 8:15am UTC](https://forums.percona.com/t/mongod-configuration/29286/3 "2024-03-22T08:15:35Z")

</div>

@Sergey_Pronin thank you very much! This indeed works as intended, apologies for not checking this place before raising the topic.  
So, yes, basically changing the oplog size in the custom resource doesn’t change the actual size, but it helps with mongod restarts. The actual change should be applied directly in the DB (first on secondaries, then on primary).

Here is the documentation: [https://www.mongodb.com/docs/manual/tutorial/change-oplog-size/](https://www.mongodb.com/docs/manual/tutorial/change-oplog-size/)
