Using Superset to Obtain Data from MySQL Databases for Analysis
Application Scenario
Superset is an open-source data exploration and visualization platform. This tool provides a quick way to intuitively visualize datasets by allowing you to create and share interactive dashboards. Supported By FlexusL, the Superset application image uses Ubuntu 22.04 and is deployed using Docker. The Nginx, Redis, pgAdmin, and Docker have been preconfigured in the image. This section describes how to use Superset to obtain data from MySQL databases for analysis.
Resource Planning and Costs
This practice uses the following resource planning as an example. You can adjust it as required.
Resource |
Configuration |
Description |
---|---|---|
Cloud server |
vCPUs: 2 Memory: 8 GiB |
A Superset application image requires at least 2 vCPUs and 8 GiB of memory. Select appropriate instance specifications accordingly. |
Image |
Superset |
Select the Superset application image. |
Security group |
Inbound rule:
|
|
Procedure
Procedure |
Description |
---|---|
Purchase a FlexusL instance and select the Superset application image. |
|
Add inbound security group rules to ensure that the application preinstalled in the image can be accessed. |
|
Set the language, log in to Superset, and reset the password. |
|
To use Superset to obtain data from MySQL databases for analysis, you need to connect to a database, add datasets, and create charts. |
Step 1: Purchase a FlexusL Instance
- Log in to the FlexusLconsole and click Buy FlexusL.
- Specify required parameters for the FlexusL instance.
Parameter
Example
Description
Region
CN-Hong Kong
For low network latency and quick resource access, select the region nearest to your target users. After a FlexusL instance is created, the region cannot be changed. Exercise caution when selecting a region.
Application Images
Superset
Select the Superset application image.
Instance Specifications
2 vCPUs | 8 GiB memory
Select instance specifications as needed.
Instance Name
Superset-Example
Customize an instance name that is easy to identify, for example, Superset-Example.
(Optional) Associated Services
- Data disk: 10 GiB
- Host security
- Cloud backup vault: 170 GiB
You can bundle any of the services to your FlexusL instances as needed: EVS, HSS (basic edition), and CBR and set specifications as needed.
Required Duration
1 month
The minimum duration of a purchase is one month and the maximum duration is three years.
Auto-renew is enabled by default, which means the purchased FlexusL instances will be automatically renewed before they expire. If you do not enable auto-renew during the purchase process, you can still enable it later after the instances are created. For more information about auto-renewal rules, see Auto-Renewal Rules.
Quantity
1
Set the number of FlexusL instances to be purchased.
- Click Buy Now and complete the payment as prompted.
- Go back to the FlexusL console and view the purchased FlexusL instance.
After a FlexusL instance is created using an application image, wait until the image with the pre-installed application is up and running. Then, you can perform operations such as restarting or stopping the instance, or resetting the password. Otherwise, the installation may fail and you cannot log in to the image application dashboard.
Step 2: Configure Security Groups
Add inbound security group rules to ensure that the application preinstalled in the image can be accessed.
- Log in to the FlexusL console and click a resource card to go to the instance details page.
- In the navigation pane on the left, choose Cloud Servers. Locate the server and click its name.
- On the Security Groups tab, click Add Rule. In the displayed dialog box, add rules displayed in the following figure and click OK.
The following figure only displays common rules. You can add more rules as needed.
Table 1 Security group rules Priority
Action
Type
Protocol & Port
Source
Description
1
Allow
IPv4
TCP: 80
0.0.0.0/0
Specifies the internal forwarding port of application images
1
Allow
IPv4
TCP: 3306
0.0.0.0/0
Allows access to MySQL databases.
1
Allow
IPv4
TCP: 9000
0.0.0.0/0
Allows external access to the application O&M dashboard.
1
Allow
IPv4
TCP: 9001
0.0.0.0/0
Allows external access to the application dashboard.
Step 3: Initialize Superset
The image application dashboard needs to be initialized only when you log in for the first time.
- Obtain the administrator username and password for logging in to GitLab.
- In the address bar of a local browser, enter http://EIP:9000 to log in to the application O&M dashboard.
The username and password for logging in to the dashboard are the root user and password of the FlexusL instance. A FlexusL instance does not have an initial password. Reset the password and use it to log in to the dashboard.
- Choose My Apps and click the App icon.
- Choose Access and click Initial Account to view the username and password of the administrator.
- In the address bar of a local browser, enter http://EIP:9000 to log in to the application O&M dashboard.
- On the Overview page, click Access in the Dashboard field in the Image area.
If the dashboard of WordPress cannot be accessed, it may be because the port for accessing the dashboard is not allowed or the application has not been up and running. To solve this problem, see Why Can't I Open the Dashboard of the Application Pre-installed in the Application Image?
- Enter the username and password obtained in step 1 to access the management page.
You can set the language on the login page or on the management page.
If a message is displayed indicating that the username or password you entered is invalid when you attempt to log in to the application dashboard, refer to Why Can't I Access the Dashboard of the Application Pre-installed in the Application Image After Entering the Initial Username and Password?
- In the upper right corner of the page, choose Settings > User > Info and click RESET MY PASSWORD.
Preset passwords are usually difficult to remember, so you are advised to set a password that is easy to remember, and please keep it safe.
Then, you have obtained a Superset hosting server. You can start using Superset or follow the steps in Step 4: Obtain Data from MySQL Databases for Analysis to connect to a database, add datasets, and create charts.
Step 4: Obtain Data from MySQL Databases for Analysis
This section describes some basic operations of Superset. For more information, see Superset Documentation.
You can only analyze data after connecting to a database first.
- On the management page, choose Data > Databases and click +DATABASE.
- Select the database to be connected, for example, the MySQL database.
- Enter the information about the database to be connected.
Table 2 Parameter descriptions Parameter
Description
HOST/PORT
Specifies the public IP address and port number of the database. The default MySQL port number is 3306.
DATABASE NAME
Specifies the name of the database to be connected.
USERNAME/PASSWORD
Specifies the username and password of the database.
DISPLAY NAME
Specifies the name displayed on Superset after the database is connected.
- Click CONNECT.
- Click FINISH and you can view the connected database in the list.
Now that you have configured a data source, you need to register tables (called Datasets in Superset) for subsequent chart creation.
- Choose Data > Datasets and click +DATASET.
- Click ADD, and you can view your dataset in the list of datasets.
Superset is a powerful visualization builder that allows you to create charts and dashboards. This section is for demonstration only. You can create exquisite charts and dashboards by referring to the official guide.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot