tencent cloud

TencentDB for MongoDB

Release Notes and Announcements
Release Notes
Announcements
User Guide
Product Introduction
Overview
Strengths
Use Cases
Cluster Architecture
Product Specifications
Features
Regions and AZs
Terms
Service Regions and Service Providers
Purchase Guide
Billing Overview
MongoDB Pricing
Billing Formula
Payment Overdue
Backup Space Billing
Configuration Adjustment Billing
Getting Started
Quickly Creating an Instance
Connecting to a TencentDB for MongoDB Instance
Reading/Writing Database
Operation Guide
Access Management
Instance Management
Node Management
Version Upgrade
Network Configuration
Monitoring
Backup and Rollback
Database Audit
Data Security
SSL Authentication
Log Management
Database Management
Multi-AZ Deployment
Disaster Recovery/Read-Only Instances
Parameter Configuration
Recycle Bin
Task Management
Performance Optimization
Data Migration Guide
Practical Tutorial
Optimizing Indexes to Break Through Read/Write Performance Bottlenecks
Troubleshooting Mongos Load Imbalance in Sharded Cluster
Considerations for Using Shard Clusters
Sample of Reading and Writing Data in MongoDB Instance
Methods for Importing and Exporting Data Based on CVM Connected with MongoDB
What to Do for Errors of Repeated Instance Creation and Deletion of Databases with the Same Names?
Troubleshooting MongoDB Connection Failures
Shard Removal Task: Guide for Confirming the Progress and Troubleshooting Issues
Performance Fine-Tuning
Ops and Development Guide
Development Specifications
Command Support in Sharded Cluster v3.2
Command Support in v3.6
Development Ops
Troubleshooting
Increased Slow Queries
Number of Connections Exceeding Limit
API Documentation
History
Introduction
API Category
Making API Requests
Instance APIs
Backup APIs
Account APIs
Other APIs
Task APIs
Introduction
Data Types
Error Codes
Instance Connection
Shell Connection Sample
PHP Connection Sample
Node.js Connection Sample
Java Connection Sample
Python Connection Sample
Python Read/Write Sample
Go Connection Sample
PHP Reconnection Sample
Product Performance
Test Environment
Test Method
Test Result
FAQs
Cost
Features
Sharded Cluster
Instance
Rollback and Backup
Connection
Data Migration
Others
Service Agreement
Service Level Agreement
Terms of Service
Glossary
Contact Us
문서TencentDB for MongoDBOperation GuideSSL AuthenticationUsing Mongo Shell to Connect to Database by SSL Authentication

Using Mongo Shell to Connect to Database by SSL Authentication

PDF
포커스 모드
폰트 크기
마지막 업데이트 시간: 2024-01-15 14:40:06

Overview

When using Mongo Shell to connect to database, you can enable Secure Sockets Layer (SSL) encryption feature to improve the security of the data linkage. The network connection can be encrypted at the transport layer with the SSL encryption feature to improve the communication data security and ensure data integrity.

Prerequisites

You have created a Linux CVM instance in the same VPC and region as the TencentDB for MongoDB instance.
You have obtained the username and password information for database instance access on the Account Management tab on the Database Management page. For detailed directions, see Account Management.
You have obtained the private IP and port for database instance access in the Instance List. For detailed directions, see Viewing Instance Details.
You have enabled SSL encryption feature on the instance. For details, see Enabling SSL Authentication.

Directions

This document uses the Linux operating system as an example to demonstrate the specific operation process.
1. Download the SSL CA certificate. For detailed directions, see Enabling SSL Authentication.
2. Upload the certificate file MongoDB-CA.crt to the CVM instance with Mongo Shell installed.
3. On the CVM instance with Mongo Shell installed, run the following command to connect to the MongoDB database.
Note:
For MongoDB 4.2 and later, Transport Layer Security (TLS) is used to perform data authentication. TLS is the security protocol of transport layer, an upgraded version of SSL. When you are not sure whether to use SSL authentication or TLS authentication, you can execute ./mongo_ssl -h to confirm the authentication method.
SSL Authentication
./bin/mongo -umongouser -plxh***** 172.xx.xx.xx:27017/admin --ssl --sslCAFile MongoDB-CA.crt --sslAllowInvalidHostnames
Replace the following parameters as needed.
-u: Database connection username
-p: Username password
172.xx.xx.xx and 27017 specify the IP (port number included) and port of the TencentDB for MongoDB instance respectively. If you forgot the username and password, view and modify the account and password as instructed in Account Management.
--sslCAFile: Certificate file path of SSL authentication
TLS Authentication
./bin/mongo -umongouser -plxh***** 172.xx.xx.xx:27017/admin --tls --tlsCAFile /data/MongoDB-CA.crt --tlsAllowInvalidHostnames
--tlsCAFile: Certificate file path of TLS authentication
4. After a successful connection, the following information will be displayed:
The prompt information may vary by MongoDB shell version. The following takes v5.0.15 as an example.


References

도움말 및 지원

문제 해결에 도움이 되었나요?

피드백