Guides
Apps
Endpoints
Databases
- Introduction to Databases
- Database Backups
- Database Credentials
- Data Encryption
- Database Encryption in Transit
- Database Endpoints
- Database Scaling
- Database Tunnels
- Replication and Clustering
- Supported Databases
- CouchDB
- Elasticsearch - 7.0 or later
- Elasticsearch - 6.8 and earlier
- InfluxDB
- MongoDB
- MySQL
- PostgreSQL
- RabbitMQ
- Redis
- SFTP
- Deprovisioning a Database
- Database Upgrade Methods
Containers
Stacks
CLI
- Aptible CLI
- aptible apps
- aptible apps:create
- aptible apps:deprovision
- aptible apps:rename
- aptible apps:scale
- aptible backup:list
- aptible backup:orphaned
- aptible backup:purge
- aptible backup:restore
- aptible config
- aptible config:add
- aptible config:rm
- aptible config:set
- aptible config:unset
- aptible db:backup
- aptible db:clone
- aptible db:create
- aptible db:deprovision
- aptible db:dump
- aptible db:execute
- aptible db:list
- aptible db:modify
- aptible db:reload
- aptible db:rename
- aptible db:replicate
- aptible db:restart
- aptible db:tunnel
- aptible db:url
- aptible db:versions
- aptible deploy
- aptible domains
- aptible endpoints:database:create
- aptible endpoints:database:modify
- aptible endpoints:deprovision
- aptible endpoints:https:create
- aptible endpoints:https:modify
- aptible endpoints:list
- aptible endpoints:renew
- aptible endpoints:tcp:create
- aptible endpoints:tcp:modify
- aptible endpoints:tls:create
- aptible endpoints:tls:modify
- aptible environment:ca_cert
- aptible environment:list
- aptible environment:rename
- aptible help
- aptible log_drain:create:datadog
- aptible log_drain:create:elasticsearch
- aptible log_drain:create:https
- aptible log_drain:create:logdna
- aptible log_drain:create:papertrail
- aptible log_drain:create:sumologic
- aptible log_drain:create:syslog
- aptible log_drain:deprovision
- aptible log_drain:list
- aptible login
- aptible logs
- aptible logs_from_archive
- aptible metric_drain:create:datadog
- aptible metric_drain:create:influxdb
- aptible metric_drain:create:influxdb:custom
- aptible metric_drain:deprovision
- aptible metric_drain:list
- aptible operation:cancel
- aptible operation:follow
- aptible operation:logs
- aptible rebuild
- aptible restart
- aptible services
- aptible ssh
- aptible version
Tutorials
- Application Performance Monitoring
- CI Integration
- Aptible Demo App
- Deploying Grafana
- Direct Docker Image Deploy Example
- Dockerfile Deploy Example
- Exposing a Web App to the Internet
- Using Nginx with Aptible Endpoints
- Quickstart Guides
- Setting up Logging
- Automating Database Migrations
- Dockerfile Caching
- Using Domain Apex with Endpoints
- Accepting File Uploads
- Scheduling Tasks
- Serving Static Assets
- Terraform
- How to test a PostgreSQL Database's schema on a new version
- How to dump and restore PostgreSQL
- How to upgrade PostgreSQL with logical replication
- How to upgrade Redis
- How to upgrade MongoDB
- How to use mysqldump to Test for Upgrade Incompatabilities
- How to dump and restore MySQL
Troubleshooting
- Aptible Support
- App Processing Requests Slowly
- This Application Crashed
- before_release Commands Failed
- Build Failed
- Container Failed to Start
- Certificate Signing Requests
- Deploys Take Too long
- git Reference Error
- git Push "Everything up-to-date."
- HTTP Health Checks Failed
- App Logs Not Being Received
- PostgreSQL Replica max_connections
- Connecting to MongoDB fails
- MySQL Access Denied
- No CMD or Procfile in Image
- git Push Permission Denied
- aptible ssh Permission Denied
- PostgreSQL Incomplete Startup Packet
- PostgreSQL SSL Off
- Private Key Must Match Certificate
- aptible ssh Operation Timed Out
- SSL error ERR_CERT_AUTHORITY_INVALID
- SSL error ERR_CERT_COMMON_NAME_INVALID
- Unexpected Requests in App Logs
MongoDB
Connecting to MongoDB
Aptible MongoDB Databases require authentication and SSL to connect.
📘 Tip
MongoDB databases use a valid certificate for their host, so you're encouraged to verify the certificate when connecting.
Connecting to the admin
database
There are two MongoDB databases you might want to connect to:
- The
admin
database. - The
db
database created by Aptible automatically.
The username (aptible
) and password for both databases are the same. However, the users in MongoDB are different (i.e. there is a aptible
user in the admin
database, and a separate aptible
user in the db
database, which simply happens to have the same password).
This means that if you'd like to connect to the admin
database, you need to make sure to select that one as your authentication database when connecting: connecting to db
and running use admin
will not work.
Clustering
Replica set clustering is available for MongoDB. Replicas can be created using the aptible db:replicate
command.
Failover
MongoDB replica sets will automatically fail over between members. In order to do so effectively, MongoDB recommends replica sets have a minimum of three members. This can be done by creating two Aptible replicas of the same primary Database.
The connection URI you provide your Apps with must contain the hostnames and ports of all members in the replica set. MongoDB clients will attempt each host until it's able to reach the replica set. With a single host, if that host is unavailable, the App will not be able to reach the replica set. The hostname and port of each member can be found in the Database's Credentials and the combined connection URI will look something like this for a three member replica set:
mongodb://username:password@host1.aptible.in:27017,host2.aptible.in:27018,host3.aptible.in:27019/db
Data Integrity and Durability
On Aptible, MongoDB is configured with default settings for journaling. For MongoDB 3.x instances, this means journaling is enabled. If you use the appropriate write concern (j=1
) when writing to MongoDB, you are guaranteed that committed transactions were written to disk.
Configuration
Configuration of MongoDB command line options is not supported on Aptible.
MongoDB Databases on Aptible autotune their Wired Tiger cache size based on the size of their container based upon Mongo's recommendation. See the image's public git repo for details.
Connection Security
Aptible MongoDB Databases support connections via the following protocols:
- For Mongo versions 2.6, 3.4, and 3.6:
TLSv1.0
,TLSv1.1
,TLSv1.2
- For Mongo version 4.0:
TLSv1.1
,TLSv1.2