1.安装mysql:
使用Docker搭建MySQL服务 - sablier - 博客园
2.下载镜像:直接启动:
docker run -it -p 8888:8888 gethue/hue:latest
[root@node2 ~]# docker run -it -p 8888:8888 gethue/hue:latest
Unable to find image 'gethue/hue:latest' locally
latest: Pulling from gethue/hue
35807b77a593: Pull complete
3d7e9d216a35: Pull complete
34f9bbb40cd9: Pull complete
56e7610c9e6a: Pull complete
55e562babacf: Pull complete
Digest: sha256:4cc54311b6ac98861369112625067a0fcdc86f4d33a93d6ba9194fa208a5bdc2
Status: Downloaded newer image for gethue/hue:latest
[15/Dec/2021 12:27:49 ] settings INFO Welcome to Hue 4.10.0
[15/Dec/2021 04:27:49 -0800] backend WARNING pam module not found
[15/Dec/2021 04:27:49 -0800] backend WARNING mozilla_django_oidc module not found
[15/Dec/2021 04:27:49 -0800] client WARNING gcs_oauth2_boto_plugin module not found
[15/Dec/2021 04:27:50 -0800] apps INFO AXES: BEGIN LOG
[15/Dec/2021 04:27:50 -0800] apps INFO AXES: Using django-axes version 5.13.0
[15/Dec/2021 04:27:50 -0800] apps INFO AXES: blocking by IP only.
3.当容器起来以后复制里面的配置文件到 /op/module/hue下 并进行修改:
[root@node2 ~]# docker cp xenodochial_ramanujan:/usr/share/hue/desktop/conf /opt/module/hue/
[root@node2 ~]#
4.修改配置文件:hue.ini
.修改:配置文件为:
engine=mysql
host=192.168.56.213
port=3306
user=root
password=123456
name=hue
[[[mysql]]]
name = MySQL
interface=sqlalchemy
# ## https://docs.sqlalchemy.org/en/latest/dialects/mysql.html
options='{"url": "mysql://root:123456@192.168.56.213:3306/hue"}'
# ## options='{"url": "mysql://${USER}:${PASSWORD}@localhost:3306/hue"}'
5.在mysql中创建数据库 hue 以供hue初始化数据使用mysql作为元数据库
停止容器,重新挂载启动:
docker run -it -d -p 8888:8888 --name hue -v /opt/module/hue/conf:/usr/share/hue/desktop/conf gethue/hue:latest
[root@node2 ~]# docker run -it -d -p 8888:8888 --name hue -v /opt/module/hue/conf:/usr/share/hue/desktop/conf gethue/hue:latest
413c7309ee8204466f1c68b9ccaa9ad31a43ed14ab770aa35c61265ee15aef67
[root@node2 ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
413c7309ee82 gethue/hue:latest "./startup.sh" 3 seconds ago Up 1 second 0.0.0.0:8888->8888/tcp, :::8888->8888/tcp hue
a66913dbcf8c mysql:5.7 "docker-entrypoint.s…" 3 days ago Up 16 minutes 0.0.0.0:3306->3306/tcp, :::3306->3306/tcp, 33060/tcp mysql
[root@node2 ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
413c7309ee82 gethue/hue:latest "./startup.sh" 4 seconds ago Up 3 seconds 0.0.0.0:8888->8888/tcp, :::8888->8888/tcp hue
a66913dbcf8c mysql:5.7 "docker-entrypoint.s…" 3 days ago Up 16 minutes 0.0.0.0:3306->3306/tcp, :::3306->3306/tcp, 33060/tcp mysql
[root@node2 ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
413c7309ee82 gethue/hue:latest "./startup.sh" 5 seconds ago Up 4 seconds 0.0.0.0:8888->8888/tcp, :::8888->8888/tcp hue
a66913dbcf8c mysql:5.7 "docker-entrypoint.s…" 3 days ago Up 16 minutes 0.0.0.0:3306->3306/tcp, :::3306->3306/tcp, 33060/tcp mysql
进入bin脚本目录:
执行命令初始化数据:
#共4行命令
#进入容器
docker exec -it hue bash
#进入bin目录
cd /usr/share/hue/build/env/bin/
#设置db
./hue syncdb
#初始化数据
./hue migrate
[root@node2 ~]# docker exec -it hue bash
hue@413c7309ee82:/usr/share/hue$ cd /usr/share/hue/build/env/bin/
hue@413c7309ee82:/usr/share/hue/build/env/bin$ ls
__pycache__ ckeygen fetch_file ipython3 mdexport.py odfoutline pyhtmlizer python-config rst2s5.py tkconch
activate conch flower isort merge_metadata.py odfuserfield pyjwt python3 rst2xetex.py trial
activate.csh cq futurize isort-identify-imports mturk parse_xsd2.py pylint python3.8 rst2xml.py twist
activate.fish csv2ods glacier kill_instance normalizer pasteurize pyreverse route53 rstpep2html.py twistd
activate_this.py cwutil gunicorn launch_instance nosetests pip pyrsa-decrypt rst2html.py runxlrd.py wamp
asadmin daphne gunicorn_paster list_instances nosetests-3.4 pip3 pyrsa-encrypt rst2html4.py s3put wheel
automat-visualize django-admin hue lss3 odf2mht pip3.8 pyrsa-keygen rst2html5.py sdbadmin xbrnetwork
avro django-admin.py hyper mailmail odf2xhtml py.test pyrsa-priv2pub rst2latex.py sqlformat xml2odf
bundle_image dynamodb_dump instance_events mailodf odf2xml pyami_sendmail pyrsa-sign rst2man.py supervisor xmlschema-json2xml
celery dynamodb_load iptest make_metadata.py odfimgimport pybabel pyrsa-verify rst2odt.py symilar xmlschema-validate
cfadmin elbadmin iptest3 mako-render odflint pydruid pytest rst2odt_prepstyles.py tabulate xmlschema-xml2json
cftp epylint ipython markdown_py odfmeta pygmentize python rst2pseudoxml.py taskadmin
hue@413c7309ee82:/usr/share/hue/build/env/bin$ ./hue syncdb
[15/Dec/2021 13:02:15 ] settings INFO Welcome to Hue 4.10.0
[15/Dec/2021 05:02:15 -0800] backend WARNING pam module not found
[15/Dec/2021 05:02:15 -0800] backend WARNING mozilla_django_oidc module not found
[15/Dec/2021 05:02:15 -0800] client WARNING gcs_oauth2_boto_plugin module not found
[15/Dec/2021 05:02:16 -0800] apps INFO AXES: BEGIN LOG
[15/Dec/2021 05:02:16 -0800] apps INFO AXES: Using django-axes version 5.13.0
[15/Dec/2021 05:02:16 -0800] apps INFO AXES: blocking by IP only.
[15/Dec/2021 05:02:16 -0800] api3 WARNING simple_salesforce module not found
[15/Dec/2021 05:02:16 -0800] jdbc WARNING Failed to import py4j
[15/Dec/2021 05:02:16 -0800] views WARNING httplib2 module not found
[15/Dec/2021 05:02:16 -0800] backend WARNING httplib2 module not found
[15/Dec/2021 05:02:16 -0800] urls WARNING djangosaml2 module not found
System check identified some issues:
WARNINGS:
jobbrowser.DagDetails.dag_info: (fields.W342) Setting unique=True on a ForeignKey has the same effect as using a OneToOneField.
HINT: ForeignKey(unique=True) is usually better served by a OneToOneField.
jobbrowser.QueryDetails.hive_query: (fields.W342) Setting unique=True on a ForeignKey has the same effect as using a OneToOneField.
HINT: ForeignKey(unique=True) is usually better served by a OneToOneField.
No changes detected
hue@413c7309ee82:/usr/share/hue/build/env/bin$ ./hue migrate
[15/Dec/2021 13:02:29 ] settings INFO Welcome to Hue 4.10.0
[15/Dec/2021 05:02:29 -0800] backend WARNING pam module not found
[15/Dec/2021 05:02:29 -0800] backend WARNING mozilla_django_oidc module not found
[15/Dec/2021 05:02:29 -0800] client WARNING gcs_oauth2_boto_plugin module not found
[15/Dec/2021 05:02:30 -0800] apps INFO AXES: BEGIN LOG
[15/Dec/2021 05:02:30 -0800] apps INFO AXES: Using django-axes version 5.13.0
[15/Dec/2021 05:02:30 -0800] apps INFO AXES: blocking by IP only.
[15/Dec/2021 05:02:30 -0800] api3 WARNING simple_salesforce module not found
[15/Dec/2021 05:02:30 -0800] jdbc WARNING Failed to import py4j
[15/Dec/2021 05:02:30 -0800] views WARNING httplib2 module not found
[15/Dec/2021 05:02:30 -0800] backend WARNING httplib2 module not found
[15/Dec/2021 05:02:30 -0800] urls WARNING djangosaml2 module not found
System check identified some issues:
WARNINGS:
jobbrowser.DagDetails.dag_info: (fields.W342) Setting unique=True on a ForeignKey has the same effect as using a OneToOneField.
HINT: ForeignKey(unique=True) is usually better served by a OneToOneField.
jobbrowser.QueryDetails.hive_query: (fields.W342) Setting unique=True on a ForeignKey has the same effect as using a OneToOneField.
HINT: ForeignKey(unique=True) is usually better served by a OneToOneField.
Operations to perform:
Apply all migrations: auth, authtoken, axes, beeswax, contenttypes, desktop, jobsub, oozie, pig, sessions, sites, useradmin
Running migrations:
Applying contenttypes.0001_initial... OK
Applying contenttypes.0002_remove_content_type_name... OK
Applying auth.0001_initial... OK
Applying auth.0002_alter_permission_name_max_length... OK
Applying auth.0003_alter_user_email_max_length... OK
Applying auth.0004_alter_user_username_opts... OK
Applying auth.0005_alter_user_last_login_null... OK
Applying auth.0006_require_contenttypes_0002... OK
Applying auth.0007_alter_validators_add_error_messages... OK
Applying auth.0008_alter_user_username_max_length... OK
Applying auth.0009_alter_user_last_name_max_length... OK
Applying auth.0010_alter_group_name_max_length... OK
Applying auth.0011_update_proxy_permissions... OK
Applying auth.0012_alter_user_first_name_max_length... OK
Applying authtoken.0001_initial... OK
Applying authtoken.0002_auto_20160226_1747... OK
Applying authtoken.0003_tokenproxy... OK
Applying axes.0001_initial... OK
Applying axes.0002_auto_20151217_2044... OK
Applying axes.0003_auto_20160322_0929... OK
Applying axes.0004_auto_20181024_1538... OK
Applying axes.0005_remove_accessattempt_trusted... OK
Applying axes.0006_remove_accesslog_trusted... OK
Applying beeswax.0001_initial... OK
Applying beeswax.0002_auto_20200320_0746... OK
Applying desktop.0001_initial... OK
Applying desktop.0002_initial... OK
Applying desktop.0003_initial... OK
Applying desktop.0004_initial... OK
Applying desktop.0005_initial... OK
Applying desktop.0006_initial... OK
Applying desktop.0007_initial... OK
Applying desktop.0008_auto_20191031_0704... OK
Applying desktop.0009_auto_20191202_1056... OK
Applying desktop.0010_auto_20200115_0908... OK
Applying desktop.0011_document2_connector... OK
Applying desktop.0012_connector_interface... OK
Applying desktop.0013_alter_document2_is_trashed... OK
Applying jobsub.0001_initial... OK
Applying oozie.0001_initial... OK
Applying oozie.0002_initial... OK
Applying oozie.0003_initial... OK
Applying oozie.0004_initial... OK
Applying oozie.0005_initial... OK
Applying oozie.0006_auto_20200714_1204... OK
Applying oozie.0007_auto_20210126_2113... OK
Applying oozie.0008_auto_20210216_0216... OK
Applying pig.0001_initial... OK
Applying pig.0002_auto_20200714_1204... OK
Applying sessions.0001_initial... OK
Applying sites.0001_initial... OK
Applying sites.0002_alter_domain_unique... OK
Applying useradmin.0001_initial... OK
Applying useradmin.0002_userprofile_json_data... OK
Applying useradmin.0003_auto_20200203_0802... OK
Applying useradmin.0004_userprofile_hostname... OK
[15/Dec/2021 05:02:46 -0800] models INFO HuePermissions: 33 added, 0 updated, 0 up to date, 0 stale, 0 deleted
hue@413c7309ee82:/usr/share/hue/build/env/bin$ exit;
exit
[root@node2 ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
413c7309ee82 gethue/hue:latest "./startup.sh" 21 minutes ago Up 21 minutes 0.0.0.0:8888->8888/tcp, :::8888->8888/tcp hue
a66913dbcf8c mysql:5.7 "docker-entrypoint.s…" 3 days ago Up 38 minutes 0.0.0.0:3306->3306/tcp, :::3306->3306/tcp, 33060/tcp mysql
[root@node2 ~]# docker restart hue
hue
[root@node2 ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
413c7309ee82 gethue/hue:latest "./startup.sh" 22 minutes ago Up 3 seconds 0.0.0.0:8888->8888/tcp, :::8888->8888/tcp hue
a66913dbcf8c mysql:5.7 "docker-entrypoint.s…" 3 days ago Up 38 minutes 0.0.0.0:3306->3306/tcp, :::3306->3306/tcp, 33060/tcp mysql
[root@node2 ~]#
7.看到有数据:
8.界面访问:
9.
10.查询数据:
11.以上为hue接入Mysql 实例
12.使用hue接入hive数据源
确保hive已经安装
修改配置文件
hive3使用11 hive2 使用 thrift_version=7
修改完成后直接 重启即可:
13.刷新界面:
hive已经作为数据源,可以进行查询:
14.以上作为 hive为数据源