edit-icon download-icon

DataV proxy configuration in Linux

Last Updated: Jul 16, 2018

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.

Procedure

  1. Buy an ECS instance. You can use the lowest possible configuration and upgrade it based on your requirements.
  2. Deploy the code and start the service.
  3. Configure the database.
  4. Configure the database to DataV.

Purchase an ECS server

payby traffic

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.

Deploy the code and start the service

Download the code package

  1. wget https://codeload.github.com/ericdum/DataVProxy/zip/master
  2. unzip master
  3. cd DataVProxy-master

Deployment

  1. make install

1

Based on the preceding figure, save the highlighted information (outlined in red) to successfully activate the service. You can also visit http://115.29.246.129:9998/status to verify the service is activated.

  • If you do not save the information at the first time, run node ./bin/info.js to see the information again.
  • To change the key, use node ./bin/genkv.js to generate a new one.
  • To check the server status, visit “http://domain:port/status

Configure the database

Open config.js and add the database to the database field, as shown in the following example.

  1. databases: [
  2. {
  3. id: 'test', // Make sure that there are no repeated IDs. Then, input them into the DataV backend database field.
  4. type: 'mysql', // rds, ads
  5. host: '127.0.0.1', // Domain name and IP address
  6. user: 'root', // User name
  7. password: 'root', // Password
  8. database: 'test', // Database name
  9. port: 3306 // Port
  10. },
  11. {
  12. // ...
  13. },
  14. // ... Enter the database you want to add here.
  15. ]

Configure the data source to DataV

  1. Log on to DataV console and go to Data Sources > Add Source.

  2. On the New Data Source page, go to the Type drop-down list and select DataV Data Proxy Service.

  3. 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.

    InternalNet

  4. In the data settings field, select the database type and the custom data source type from the previous figure.

    InternalNet

Note:

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.

O&M

Check real-time logs

  1. pm2 logs

Check history logs

  1. ls -al ./DataVProxy-master/logs

Restart

  1. pm2 restart all

Start service

  1. pm2 start app.js
Thank you! We've received your feedback.