In hue (04), Hue integrated Hive data warehouse , we integrated the hive data warehouse in hue, instead of hive's own hwi service, it is very convenient to perform hive sql query and other operations in hue. In this article, we will integrate mysql, oracle and other databases in hue, so that the data in the data storage service can be operated in hue.
1. Environmental preparation
1.hadoop cluster service
2.hive-mysql metabase service
3.hive service
4.hue4.1 service
5.mysql database service
6. oracle database service
2. Preparation for integration
1. Start the hadoop cluster
Start hadoop three machines, and then start the hadoop cluster on the master node machine: start-all.sh
2. Start the Hiveserver service
Start the hiveserver service on the hive machine: hive --service hiveserver2 or hive --service hiveserver2 &
3. Start the Hive Metastore service
Start the Hive Metastore service on the hive machine: hive --service metastore or hive --service metastore &
If you see the following information, the startup is complete:
4. Start the Hue service
Execute the ./supervisor command in hue's /bulid/env/bin/ directory to start the hue service
5. Verify Boot
Enter jps -ml in the terminal to view:
You can see that the hive services in the hadoop cluster are all started normally.
6. Start the data storage service
Start database services such as mysql and oracle that require hue integration respectively
3. Integrated MySQL service
1. Configuration process
Open the pseudo-distributed.ini file in hue's /desktop/conf/ directory
Edit the pseudo-distributed.ini file, find [[databases]] under the [librdbms] section, and add information about integrating mysql
Service configuration information:
[[[mysql]]]
nice_name=db_mysql
engine=mysql
host=hdpc05
port=3306
user=root
password=123456
2. Verification process
If the hue service was started before, restart the hue service first, and then log in to the hue service console page:
Click the mysql tab, you can see that the mysql database service has been successfully integrated
3. Simple to use
Double-click a database to see the tables in the library or right-click and select Open in Browser. In the Table Browser view on the right, you can
to see the tables under that database:
or
Select the table in the Table Browser view and click view to view the table structure information and table data information:
You can see the table structure and part of the table data. For more operations, click on the other operation labels. I won't demonstrate too much here.
4. Integrate Oracle Services
1. Configuration process
Open the pseudo-distributed.ini file in hue's /desktop/conf/ directory
Edit the pseudo-distributed.ini file, find [[databases]] under the [librdbms] section, and add information about the integration
Configuration information of oracle service:
[[[oracle]]]
nice_name=db_oracle
engine=oracle
host=192.168.1.102
port=1521
user=***
password=***
After the configuration is complete, restart the hue service. We log in to the hue control state and click the oracle storage to view it. The console prompts the following error:
Error loading cx_Oracle module: No module named cx_Oracle
This is because hue is written in python, so the cx_Oracle module is required when using python to connect to oracle.
To configure the two official Oracle client files, let's start the configuration process:
1>. Download the two client files required for the oracle connection
instantclient-basic-linux.x64-12.2.0.1.0.zip
instantclient-sdk-linux.x64-12.1.0.2.0.zip
Download address: http://www.oracle.com/technetwork/topics/linuxx86-64soft-092277.html
2>. Use ftp to upload to the oracle directory of hue
The uploaded files are as follows:
Extract both files to instantclient12.2:
The files after all decompression are as follows:
3>. Add environment variables
Write the following configuration using the command vi /etc/profile:
#Oracle client Profile
export ORACLE_HOME=/home/hue-branch-4.1/oracle/instantclient12.2/
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME
Use source /etc/profile to make the configuration take effect immediately:
4>. Create a soft connection
ln -s libclntsh.dylib.11.1 libclntsh.dylib
ln -s libocci.dylib.11.1 libocci.dylib
ln -s libclntsh.so.11.1 libclntsh.so
5>. Install a block of cx_Oracle
Use find / -name pip to find the pip directory
cd /home/hue-branch-4.1/build/env/bin
Then execute ./pip install cx_Oracle installation
So far, a block of cx_Oracle has been installed.
2. Verification process
After the configuration is complete, we log in to the hue console and click the oracle tab. The console prompts an error of 'name':
This is because there is one less name parameter when configuring oracle:
After the configuration is complete, we restart the hue service to view the hue console:
At this point, the integrated configuration of hue to oracle is completed. The specific use is similar to that of mysql, which is the same as the above.
V. Summary
This article is to integrate mysql and oracle services in hue. The integration of mysql is relatively simple, and the integration of oracle is a bit more complicated, requiring the main
There are many places, and the pits encountered during the integration process are all uninstalled in the text. I hope it can help everyone.