# huaweicloud-haydn-tools-and-sample-code **Repository Path**: HuaweiCloudDeveloper/huaweicloud-haydn-tools-and-sample-code ## Basic Information - **Project Name**: huaweicloud-haydn-tools-and-sample-code - **Description**: Haydn解决方案数字化平台加速场-工具&示例代码,华为云验证团队持续沉淀方案构建、验证过程中自研的工具&示例代码并上架至Haydn平台,加速伙伴快速完成与指定云服务的预集成及验证。 - **Primary Language**: Unknown - **License**: Apache-2.0 - **Default Branch**: master-dev - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2022-08-25 - **Last Updated**: 2023-05-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Haydn交付中心数据探源工具 本项目是Haydn解决方案数字化平台交付中心数据探源工具, 可以用于探查源端数据库 库、表、字段维度的数据详情。 免责声明:本代码为Haydn平台加速场示例代码,Haydn解决方案数字化平台及华为云计算公司不对该代码负任何责任。 ## 使用方法: 1、编译本项目,打成jar 包。(jar包已提供为3个分段压缩包。把三个子压缩包放在一个文件夹中解压即可得到完整jar包。但是可以通过修改代码,重新编译打包。) 2、将jar包放入远端服务器中。同文件下需要放入```application.properties```文件。 注意:该文件请到Haydn平台下载使用。 3、本工具将占用8809端口。如需修改,请直接修改application.yaml文件中的代码,重新编译后启用。 ``` #db.cron是采集数据库维度的时间配置 db.cron= #table.cron是采集表维度的时间配置 table.cron= #field.cron是采集字段维度的时间配置 field.cron= #report.cron是采集数据在线上报的时间配置 report.cron= #tablenaming.cron是表命名规范检查的时间配置 tablenaming.cron= #tablefield.cron是附加字段检查的时间配置 tablefield.cron= #monitor.cron是实施质量检查数据在线上报的时间配置 monitor.cron= # [必需]为Haydn交付中心中数据源名称。不能填错 db.linkname.1= # [必需]源端数据库类型。可选择:oracle、mysql(全小写) db.dbtype.1= # [必需]目标数据库 ip地址:端口号 db.hosts.1= db.port.1= # [必需]目标数据库用户名 db.username.1= # [必需]目标数据库登录密码 db.password.1= # [必需]目标数据库名称(mysql不填默认扫全实例。oracle必填。) db.database.1= # [必需]目标数据库schema(mysql不涉及,oracle必填) db.schema.1= # [非必需]目标数据库采集表用英文逗号,分隔,如果不填写则默认整库全表采集 db.tables.1= ``` 4、运行启动脚本 ```run_agent.sh``` 启动脚本示例如下: ``` find_pid=`netstat -atpn | grep LISTEN | grep -E '8809' | grep '/java' | awk '{print $7}' | awk -F '/' '{print $1}'` if test ! -z $find_pid; then echo "old process id: " $find_pid kill -9 $find_pid echo "old process stopped" fi echo "start serivce..." nohup java -jar haydn-delivercore-agent-1.0.0.jar >./haydn-delivercore-agent.log 2>&1 & sleep 1 tail -f ./haydn-delivercore-agent.log for _ in 1 2 3 4 do if test ! -z $find_pid; then echo "new process id:" $find_pid echo "service OK" exit 1 fi done ``` 5、查看日志:tail -f -n 500 haydn-delivercore-agent.log 6、停下工程:运行停止脚本```stop_agent.sh``` 脚本示例如下: ``` pid=$(netstat -atpn | grep LISTEN | grep -E '8809' | grep '/java' | awk '{print $7}' | awk -F '/' '{print $1}') if [[ ! -z $pid ]]; then echo "process stopping: $pid" kill -9 $pid echo "status OK" else echo "process dose not exist" fi ``` 7、数据库类型为MRS,且开启了安全认证的使用方式: (1)登录Manager界面,点击 系统-用户,查找需要连接到Hive的安全用户,点击 更多-下载认证凭据,解压得到两个文件:```krb5.conf```和```user.keytab```。 (2)登录Manager界面,点击 集群-服务-Hive-更多-下载客户端,选择仅配置文件,下载,在解压后的目录(压缩文件的目录\FusionInsight_Cluster_1_Hive_ClientConfig_ConfigFiles.tar\FusionInsight_Cluster_1_Hive_ClientConfig_ConfigFiles\Hive\config)中,得到```hiveclient.properties``` 文件。 (3)将上述三个文件,放置在```application.properties```文件的相同路径下。 ## 开源协议 Haydn交付中心数据探源工具 采用 Apache 2.0 License.