how to enable data at rest encryption in percona mongodb 8.0
and how to give root user and admin password in docker-compose
>how to enable data at rest encryption in percona mongodb 8.0
You can encrypt the data files using a Master encryption key. The key can be local or managed by an external key server like Hashicorp vault etc. For example, to use local key management:
# Create a key file
$ openssl rand -base64 32 > mongodb-keyfile
$ chmod 600 mongodb-keyfile
# use it to encrypt data files while starting the database
$ mongod --enableEncryption --encryptionKeyFile mongodb-keyfile ...<other options>...
Check here - Data at rest encryption - Percona Server for MongoDB 8.0
>and how to give root user and admin password in docker-compose
You can set it via environmental variables while deploying the Docker container as follows:
$ docker run -d --name container-name \
-e MONGO_INITDB_ROOT_USERNAME=mongoadminuser \
-e MONGO_INITDB_ROOT_PASSWORD=secretpwd \
percona/percona-server-mongodb:tag
$ docker exec -it container-name \
mongo -u mongoadminuser \
-p secretpwd \
--authenticationDatabase admin
For docker compose, you can pass as environment parameters like shown in below example:
services:
mongodb:
environment:
MONGO_INITDB_ROOT_USERNAME: {ROOT_USERNAME}
MONGO_INITDB_ROOT_PASSWORD: {ROOT_PASSWORD}
Check here - Run in Docker - Percona Server for MongoDB 8.0
Hope this helps you!
Regards,
Vinodh Guruji