With DataV data proxy services, you can configure safer data queries without the need to apply database permissions or write APIs. The DataV data proxy services pass encrypted SQL query strings and database ID values to applications that can connect to the database, get query results, and return the results to the DataV page.
Click here to download a sample application published on GitHub. The application can be deployed to an ECS instance.
The following procedure uses a Node.js sample application.
- Buy an ECS instance. You can use the lowest possible configuration and upgrade it based on your requirements.
- Deploy the code and start the service.
- Configure the database.
- Configure the database to DataV.
To purchase a cost-effective ECS server, we recommend you:
- Select Pay-As-You-Go as a billing option.
- Select Public Image from the Images section, and select CentOS 7.4 64-bit.
- Select PayByTraffic from the Network Billing Method section.
- Select a data disk if you have any special requirements.
- Select other configurations and complete the purchase according to the preceding figure.
Download the code package
Based on the preceding figure, save the highlighted information (outlined in red) to successfully activate the service. You can also visit http://18.104.22.168:9998/status to verify the service is activated.
- If you do not save the information at the first time, run
node ./bin/info.jsto see the information again.
- To change the key, use
node ./bin/genkv.jsto generate a new one.
- To check the server status, visit “http://domain:port/status“
Open config.js and add the database to the database field, as shown in the following example.
id: 'test', // Make sure that there are no repeated IDs. Then, input them into the DataV backend “database” field.
type: 'mysql', // rds, ads
host: '127.0.0.1', // Domain name and IP address
user: 'root', // User name
password: 'root', // Password
database: 'test', // Database name
port: 3306 // Port
// ... Enter the database you want to add here.
Log on to DataV console and go to Data Sources > Add Source.
On the New Data Source page, go to the Type drop-down list and select DataV Data Proxy Service.
Enter the information from the previous Deployment section (outlined in red) into the following input box. For more information about the parameters, see Add DataV Data Proxy Service.
In the data settings field, select the database type and the custom data source type from the previous figure.
This service SDK only provides HTTP services. If you need HTTPS services, you must apply for an HTTPS certificate recognized by Google Chrome. We recommend you enable HTTP services until the HTTPS certificate is applied.
Check real-time logs
Check history logs
ls -al ./DataVProxy-master/logs
pm2 restart all
pm2 start app.js