Remote Access
Remote Access to MySQL/MariaDB/Percona
You can work with your databases remotely from your computer without having to login to our dashboard. So here are some instructions on how to access with MySQL. They can be used both for Java and PHP environments.
- The same steps can be used for remote access to MariaDB and Percona.
Create Environment
-
Log into the platform.
-
Click the Create environment button at the top left.
-
In the Environment Topology dialog, pick your application server and MySQL as the database you want to use. Switch on Public IPv4 for MySQL. Then type your environment name, for example, dumptest.
-
Click info button for MySQL and you’ll see your public IP in the end of the dropdown list.
Remote Connection to MySQL
-
Create a new open connection to start querying using any desktop client for MySQL (we’ll use MySQL Workbench as an example). Specify the connection name, enter the host name (your Public IP), port number (3306), username and password (when you created the environment, the platform sent you an email with credentials to the database).
-
Now MySQL remote access is configured and you can start querying.
Remote Access to PostgreSQL
You have an opportunity to work with your databases remotely from your computer without having to login to our dashboard. Here’s a how-to for PostgreSQL users.
Create Environment
The database can be accessed either via public IP or endpoints (no public IP required). Let’s take a look at both options of creating database environment.
Environment with Public IP
-
Log into the platform.
-
Click the New Environment button at the top left of the dashboard.
-
In the Environment Topology wizard pick PostgreSQL as the database you want to use. In case you want to get a database cluster just slide to the right the Auto-Clustering switch. Then add a Public IPv4. After that enter an environment name, click Create button.
Environment without Public IP
-
The algorithm is the same as above and clustered database environment will be created but with no public IP attached.
-
Once the environment is ready, go to the Endpoints at the Settings section and click on Add to create new port mapping.
-
Choose the Node you need to access and PostgreSQL service Name. The rest parameters will be generated automatically: Private Port, Protocol, Public Port, and Access URL.
Remote Connection to PostgreSQL
To establish a connection to a PostgreSQL database, a desktop or web-based client can be used. One of the most popular and feature-rich open-source tools for this purpose is pgAdmin 4. pgAdmin 4 provides a comprehensive graphical interface for managing PostgreSQL databases. It is available for multiple platforms and can be installed locally or deployed as a web application Alternatively, pgAdmin 4 can be deployed within your platform environment using the relevant deployment manifest.
-
If you have a database cluster it will be more convenient to create a group of all servers that belong to the cluster.
-
Then enter Name of the group e.g. remotepostgres.
-
After that add one by one all of the database servers to the group. Let’s see how to do that for the Master database. Make a right-click on the group (e.g. remotepostgres) and choose Create > Server.
-
Enter the server name (e.g. Master for the primary database of your cluster) at the General tab.
-
At this step you have to specify server access settings depending on whether you created database with or without public IP as described above.
Connection to Public IP:
- Go to the Connection tab and enter public IP of your master database at the Host name/address field. Specify Username and Password you have obtained while creating the database environment via email.
Connection via Endpoints:
- Take the URL and Public Port from generated port mapping and set the database server connection settings. The Username and Password are the same as described above.
-
You may change other specific options if you are rather confident in your actions.
-
Finally, press the Save to apply the changes and you will see that connection is successfully established.
Remote Access to MongoDB
You can access your MongoDB database remotely from your local computer or any other server.
Set up MongoDB Environment
- In order to establish a remote connection to the database, you need to ensure that your MongoDB container is externally accessible. This can be done by attaching a public IP address or configuring an endpoint.
- You can attach a public IP address to your MongoDB container using the topology wizard. This option is recommended for production environments.
- Add a public IP during the environment creation process or use the Change Environment Topology option for an existing environment.
- An endpoint can be created from the environment’s Settings > Endpoints tab. This option is recommended for development/testing environments.
-
Select the pre-defined MongoDB template to expose the private port 27017 (default port for MongoDB connection) via the endpoint.
-
After creation, you can use the Access URL and Public Port to connect to your MongoDB database at private port 27017.
- Either of these options will make your MongoDB container remotely accessible.
Remote Connection to MongoDB
Below, we’ll provide an example of how to connect to your MongoDB database using the mongosh command-line tool. It allows setting up a direct connection from the SSH terminal on your local computer or any server.
- Use the following command to remotely connect to your MongoDB database:
mongosh --host {host} --port {port} -u {username} -p {password} --authenticationDatabase {authDatabase} {database}
- host - MongoDB database address. Use either the public IP address of your MongoDB container or the endpoint’s Access URL.
- port - target port number (default is 27017). Use the default port 27017 for public IP and the Public Port for the endpoint.
- username and password - database access credentials (default ones are sent via email after the environment creation). You can skip the password parameter in the command and enter it interactively.
- authDatabase - authentication database for the specified user (if not specified, the same database you are connecting to is used). Only needed if the user is not defined in the database you are connecting to.
- database - database you want to connect to (default is test).
-
To connect to the MongoDB database using the public IP address, it’s enough to provide the IP address and username in the command.
-
To connect using the endpoint, you need to specify its Access URL and Public Port.
-
After the connection is established, you can start working with your MongoDB database directly from the terminal.