代理内 cent os7 安装 ambari + metron

完整步骤 参考https://cwiki.apache.org/confluence/display/METRON/Metron+0.4.1+with+HDP+2.5+bare-metal+install+on+Centos+7+with+MariaDB+for+Metron+REST

遇到问题:

1、代理问题

linux 代理 可能需要在系统和yum,maven, npm 等个多个地方设置。

启动xrdp服务,使用远程桌面比较方便。

2、yum locked 问题

 

kill不了,可以通过强制关掉yum进程:

#rm -f /var/run/yum.pid
  • 1

然后就可以使用yum了。

3、执行mvn clean package -DskipTests -T 2C -P HDP-2.5.0.0,mpack时遇到npm err!

参考https://community.hortonworks.com/questions/148454/metron-041-build-failure-metron-config-failed-to-e.html

将c++ 编译器升级到新版本后可以解决!

 

  1. sudo yum install centos-release-scl
  2. sudo yum install devtoolset-4-gcc*
  3. scl enable devtoolset-4 bash
  4. which gcc
  5. gcc --version

4、 docker 代理设置

install 过程 遇到 docker pull。。。。connection。。错误 

参考 https://stackoverflow.com/questions/23111631/cannot-download-docker-images-behind-a-proxy

https://docs.docker.com/config/daemon/systemd/#httphttps-proxy

 

A quick outline:

First, create a systemd drop-in directory for the docker service:

mkdir /etc/systemd/system/docker.service.d

Now create a file called /etc/systemd/system/docker.service.d/http-proxy.conf that adds the HTTP_PROXY environment variable:

[Service]
Environment="HTTP_PROXY=http://proxy.example.com:80/"

If you have internal Docker registries that you need to contact without proxying you can specify them via the NO_PROXY environment variable:

Environment="HTTP_PROXY=http://proxy.example.com:80/"
Environment="NO_PROXY=localhost,127.0.0.0/8,docker-registry.somecorporation.com"

Flush changes:

$ sudo systemctl daemon-reload

Verify that the configuration has been loaded:

$ sudo systemctl show --property Environment docker
Environment=HTTP_PROXY=http://proxy.example.com:80/

Restart Docker:

$ sudo systemctl restart docker

 

5 docker 继续遇到一个大麻烦

 

mvn clean install -DskipTests -PHDP-2.5.0.0

这个过程会进入docker镜像执行一系列的安装设置操作,但这些脚本依赖于yum和 wget 。由于在代理服务器后面,所以需要对docker镜像的yum和wget进行设置。

执行的时候会遇到

Sending build context to Docker daemon 834.6 MB
Step 1/13 : FROM centos:centos6
 ---> 26cb1244b171
Step 2/13 : RUN yum install -y tar
 ---> Running in c2ce83755e08


Loaded plugins: fastestmirror, ovl
Setting up Install Process
Error: Cannot retrieve repository metadata (repomd.xml) for repository: base. Please verify its path and try again
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=6&arch=x86_64&repo=os&infra=container error was
14: PYCURL ERROR 7 - "Failed to connect to 2604:1580:fe02:2::10: Network is unreachable"
The command '/bin/sh -c yum install -y tar' returned a non-zero code: 1

[ERROR] Command execution failed.

这个问题是 执行过程中 docker客户机执行yum install的 时候无法连接ipv6的地址导致的。

关于docker的这个bug 有很多提到的,但网上没有解决的办法。。。。。

换个思路 如果在docker里面 修改yum的源地址为国内地址应该能解决。。。

解决方法是这样的

先用

docker images 命令查找docker镜像

docker run -it  centos /bin/bash  进入centos  镜像命令行

修改镜像中的  /etc/yum.repos.d/CentOS-Base.repo 文件 更换为可以链接的yum源

后面docker还要用到wget  

yum install -y wget

vi /etc/wgetrc 

启用wget代理设置  

# They will override the value in the environment.
https_proxy = http://xx.xx.xx.xx:xx/
http_proxy = http://xx.xx.xx.xx:xx/
ftp_proxy = http://xx.xx.xx.xx:xx/
 
# If you do not want to use proxy at all, set this to off.
use_proxy = on 

在服务器 使用命令

docker commit 84e25b2bab30 docker.io/centos:centos6    (84e25b2bab30为容器id

提交镜像更改,创建一个新的镜像。

再进行

mvn clean install -DskipTests -PHDP-2.5.0.0

经过一阵耐心地等待。。。success!

然而。。。问题还有

RPMS下没有noarch文件夹,也没有编译的rpm包。

仔细观察 日志中还有  

rpmbuild command not found 、rpmlint command not found 和  Macro %_prerelease empty body 等错误。

 解决方法:

yum install -y rpm-build

yum install -y rpmlint

然后运行

./root/metron/metron-deployment/packaging/docker/rpm-docker/build.sh 0.4.1(注意0.4.1为版本号)

经过等待   rpm  包出现在了指定的位置。。。。

6 ambari server 代理设置

 

Configure Internet Proxy Settings for Ambari Server

  1. On the Ambari Server host, stop Ambari Server:

    ambari-server stop

  2. Add proxy settings to the following script: /var/lib/ambari-server/ambari-env.sh.

    -Dhttp.proxyHost=<yourProxyHost> -Dhttp.proxyPort=<yourProxyPort>

  3. Optionally, to prevent some host names from accessing the proxy server, define the list of excluded hosts, as follows:

    -Dhttp.nonProxyHosts=<pipe|separated|list|of|hosts>

  4. If your proxy server requires authentication, add the username and password, as follows:

    -Dhttp.proxyUser=<username> -Dhttp.proxyPassword=<password>

  5. Restart the Ambari Server to pick up this change.

注意的是 也要配置https的 代理设置  格式与http一样。

 

7 设置离线安装源

网上有很多这个的文章  基本上就是 设置 HDP,HDPUTILS和AMBARI的源下载到本地,安装一个http服务提供下载。有的时候安装cluster重新设置后,在安装的时候会遇到 报repo。。。。。的错误。

这个时候需要  stop ambari-server然后

执行  ambari-server reset  重置服务器状态。重新进行安装设置 就好了。

 

8 hdfs 中 的 dashboard上显示有三个启动成功的 datanode,但只有 一个  live的 datanode。

查看datanode 和 namenode 日志发现 

 

2018-04-23 14:44:05,743 INFO  datanode.DataNode (BPServiceActor.java:register(687)) - Block pool BP-1626029470-10.110.0.46-1523411499327 (Datanode Uuid e32aa2ea-9df5-4d2a-b8fc-52dd41cd83f2) service to master.jluhp.edu.cn/10.110.0.46:8020 beginning handshake with NN
2018-04-23 14:44:05,746 ERROR datanode.DataNode (BPServiceActor.java:run(747)) - Initialization failed for Block pool BP-1626029470-10.110.0.46-1523411499327 (Datanode Uuid e32aa2ea-9df5-4d2a-b8fc-52dd41cd83f2) service to master.jluhp.edu.cn/10.110.0.46:8020 Datanode denied communication with namenode because hostname cannot be resolved (ip=10.110.0.47, hostname=10.110.0.47): DatanodeRegistration(0.0.0.0:50010, datanodeUuid=e32aa2ea-9df5-4d2a-b8fc-52dd41cd83f2, infoPort=50075, infoSecurePort=0, ipcPort=8010, storageInfo=lv=-56;cid=CID-51bf3a43-568e-4c54-a8b7-a3f9cfaa6f1a;nsid=1412723871;c=0)
at org.apache.hadoop.hdfs.server.blockmanagement.DatanodeManager.registerDatanode(DatanodeManager.java:899)
at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.registerDatanode(FSNamesystem.java:4653)
at org.apache.hadoop.hdfs.server.namenode.NameNodeRpcServer.registerDatanode(NameNodeRpcServer.java:1404)
at org.apache.hadoop.hdfs.protocolPB.DatanodeProtocolServerSideTranslatorPB.registerDatanode(DatanodeProtocolServerSideTranslatorPB.java:100)

原因就是  namenode 无法反向解析 datanode,这个有几个解决办法,我在master的 hosts 文件里配置datanode的 解析地址就可以解决。

参考https://log.rowanto.com/why-datanode-is-denied-communication-with-namenode/

 

 

9 启动hbase 遇到过一会 就会停掉

查看日志/var/log/hbase/hbase****.log

2018-04-24 08:12:37,974 FATAL [master:16000.activeMasterManager] master.HMaster: Unhandled exception. Starting shutdown.
org.apache.hadoop.ipc.RemoteException(java.io.IOException): File /apps/hbase/data/.tmp/hbase.version could only be replicated to 0 nodes instead of minReplication (=1).  There are 3 datanode(s) running and no node(s) are excluded in this operation.
at org.apache.hadoop.hdfs.server.blockmanagement.BlockManager.chooseTarget4NewBlock(BlockManager.java:1649)
at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.getNewBlockTargets(FSNamesystem.java:3198)
at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.getAdditionalBlock(FSNamesystem.java:3122)
at org.apache.hadoop.hdfs.server.namenode.NameNodeRpcServer.addBlock(NameNodeRpcServer.java:843)

参考 https://stackoverflow.com/questions/34245682/could-only-be-replicated-to-0-nodes-instead-of-minreplication-1-there-are-4

https://community.hortonworks.com/questions/110806/remaining-capacity-of-hdfs-0.html

这个 主要还是 hadoop 和zookeeper有问题,比如 1 live node,空间不足 ,服务没启动等等。

具体要查看 /var/log下 hadoop 和hbase的 log 解决。

 

10 hive  设置

hive 需要 提前在mysql 创建 表空间 用户 ,并且授权。

  创建hive数据库
# mysql -uroot -p
CREATE DATABASE hive;

 创建hive用户并赋予权限
# mysql -uroot -p
use hive;

CREATE USER 'hive'@'localhost' IDENTIFIED BY 'hive';

GRANT ALL PRIVILEGES ON *.* TO 'hive'@'localhost';
CREATE USER 'hive'@'%' IDENTIFIED BY 'hive';

GRANT ALL PRIVILEGES ON *.* TO 'hive'@'%';

 

FLUSH PRIVILEGES;

 

 

 

 

11 测试kafka 

用console 测试的时候  参数必须严格按照配置进行

注意 段口号 和 域名,以及ip~  

用域名配置的 应该用域名访问。

 

12 空间问题

hdp系统会产生大量日志,要注意磁盘空间剩余情况~

 

13 elasticsearch  安装和配置

https://community.cloudera.com/t5/Community-Articles/How-To-Install-ELK-Stack-6-3-2-in-Ambari/ta-p/248842

内网安装 参考这个  文章  https://blog.youkuaiyun.com/ZhouyuanLinli/article/details/77725599,需要自己搭建个yum 源,修改repo文件和 elasticsearch

重点是关于 ES的配置一定要注意ambari中ES参数的格式  比如 需要""和[] 还有,等 ,这个一定要注意!!

连接kibana   需要  http_cors_enabled  设置为  "false"

zen_discovery_ping_unicast_hosts  设置为 ES集群master的 地址 格式为[ xxx.xxx.xxx.xx ]

expected_data_nodes 要根据集群dn 数量设置   

gateway_recover_after_data_nodes   要根据集群dn 数量设置  否则会无法正常使用!

 

安装了ik中文分词经常会导致master not found故障,删除原来的数据问题解决,但还需要进一步测试。

 

其他问题根据 log  参考网上解决~

14 kibana  在 chrome里面会有 认证错误 换个浏览器 firefox会解决

kibana右上角有时间区间设置,会影响 logstash 数据 discover~

15 kibana 地图 白板问题 因为kibana原来的地图收费了。。。所以要改成 新的源比如 高德地图

进入到安装目录下的src/ui/public/vislib/visualizations/目录

1.编辑_map.js文件

//url: 'https://otile{s}-s.mqcdn.com/tiles/1.0.0/map/{z}/{x}/{y}.jpeg',
url: 'http://webst0{s}.is.autonavi.com/appmaptile?lang=zh_cn&style=7&x={x}&y={y}&z={z}',

注释之前的//url: 'https://otile{s}-s.mqcdn.com/tiles/1.0.0/map/{z}/{x}/{y}.jpeg',

添加url: 'http://webst0{s}.is.autonavi.com/appmaptile?lang=zh_cn&style=7&x={x}&y={y}&z={z}',

 

2.删除kibana目录下的optimize/bundles文件夹

3.重新启动

16 tilemap 里的模式匹配问题

官方例子 里日志要匹配成为logstash-*模式 才能识别 地理信息!

es 里index设置数据   kibana里匹配模式  都很重要~

高德地图匹配的不是很好  匹配一下大小 才有地图出来!

具体看https://blog.youkuaiyun.com/ming_311/article/details/50619859介绍

17 kibana 插件安装

bin/kibana plugin -i xxxxx.zip

 

18 logstash 读 kafka 问题

有时候能读到  有时候读不到~

logstash 需要配置  consumer_id

input {
  kafka {
    zk_connect => "master.jluhp.edu.cn:2181"
    topic_id => "test"
   # codec => "plain"
    consumer_threads => 1
    consumer_id => "1871"
   # decorate_events => true
   # type => "nginx-access-log"
   # start_position => "beginning"
}
}
 

19 metron Enrichment 无法启动

这个服务启动不了,察看日志是

/var/lib/ambari-agent/cache/common-services/METRON/0.4.1/package/scripts/enrichment_commands.py

中无法下载GeoLite2-city.mmdb.bz这个文件

原因是那个链接无效了 。参考  https://dev.maxmind.com/geoip/geoip2/geolite2/   官方说明。

解决方法也很简单,把这个文件下载回来放到一个可以下载位置,直接修改enrichment_commands.py的115行为下载地址就可以了。

 

20  metron REST 服务启动 以后 一会就停止  状态变为 stoped

这个问题也困扰了我好几天。。。。。。然后,忽然发向hbse的regionserver也就剩了一个。。

检查了一下发现几台服务器的时钟没有同步,同步服务器停了。

重新设置时钟服务器 问题解决了

 

 

 

 

目前就遇到这些问题,待遇到其他问题陆续更新。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值