Baidu AI Cloud
中国站

百度智能云

Data Visualization-Sugar

Intranet tunnel

If your database is on the intranet and cannot be accessed through the public network, you can try the intranet tunnel function provided by Sugar.

It should be noted that this feature has an ordinary stability as it relies on public network. In terms of security, we made IP Whitelist restrictions and adopts Baidu AI Cloud private network connection. However, if you have very high requirements on both stability and security, you are recommended to use Private Deployment

Dependent Environment

To use the intranet tunnel, you need to find a machine (MAC, Linux and windows 7+, which can be the machine where the database is located) to run the tunnel client. This machine needs to meet two conditions:

  1. Access to your intranet database
  2. Access to the public network (as long as it can be accessed, there is no need for public IP)

After you find such a machine, you can use the intranet tunnel function.

The client has no requirements for machine configuration. If your database machine can access the Internet, you can use this machine directly.

Create an Intranet Tunnel

The administrator can enter the [Data Source] in the [Management Center] from the navigation bar on the left side, where intranet tunnel can be created. At present, each group can create up to 5 intranet tunnels, each intranet tunnel corresponds to a database connection address, and can connect multiple databases in a database server through the same tunnel:

tunnelmanagement

Download Client and Run

After creating the intranet tunnel, you can see it in the intranet tunnel list. Click "download tunnel client" to copy the downloaded zip to the machine mentioned earlier.

After decompression, you can see the following files:

  • conf directory, this is the system related configuration, don't care
  • db.txt, this is the database configuration
  • start.sh, this is the startup script for Mac and Linux
  • start.ps1, this is the startup script under Windows

First, open the db.txt file with a text editor. The default content is 127.0.0.1:3306. You need to change it to the address and port of the local database.

After editing and saving the db.txt file, if it is Mac and Linux, run the following command:

```
bash start.sh
```

If you need to run it for a long time, use the following command:

nohup bash start.sh &

Startup under Windows

Because Windows is prone to errors, three methods are provided:

  1. Start.exe, a program that can be stationed in the lower right corner, needs to be downloaded separately from here, put it in the unzipped directory, double-click to run it
  2. Start.ps1, but script execution is disabled by default under windows. You need to start it as follows:

    1. Click the windows chart in the lower left corner and enter PowerShell
    2. Right click it and run as Administrator enablesecurity
    3. Enter set-executionpolicy remotesigned
  3. Manually download Sugar_tunnel_client.exe and put it into the unzipped directory. Double click to run it

For 32-bit Windows system, please download this version:sugar_tunnel_client.exe. But it seems that it will be misjudged as a Trojan horse by several anti-virus softwares such as Microsoft and 360, so you need to add it to the white list.

Use Intranet Tunnel

When adding and editing data sources, you can select which intranet tunnel to use through the drop-down box at the bottom. When using intranet, you do not need to fill in the database address and port. These information are edited in the previous client.

usetunnel

Precautions

Due to the exclusive characteristics of the port, each tunnel can only establish a connection with one tunnel client, so if there is already a client connection, you can only close the previous client process first, or apply for a new intranet tunnel.