解决 Atlas 内置 Zookeeper 与现有集群 Zookeeper 的端口冲突问题


这两天安装 Atlas1.2.0(内置 HBase、Solr 模式)的时候,遇到了这个问题:

内置模式下,HBase 会启动一个内置的 Zookeeper 实例,默认也是使用 2181 端口,遇到集群现有的 Zookeeper 已经启动,2181 端口被占用的情况,这个内置的 Hbase 就会启动失败,导致 Atlas 不可用

1
java.io.IOException: Could not start ZK at requested port of 2181.  ZK was started at port: 2182.  Aborting as clients (e.g. shell) will not be able to find this ZK quorum.


让现有集群的 zk 继续使用 2181 端口,内置 zk 改用 2188 端口

  1. 修改内置的 HBase 配置文件

    • 1
      2
      
      nano /opt/apps/atlas-1.2.0/hbase/conf/hbase-site.xml
      	# 添加如下属性
      
    • 1
      2
      3
      4
      5
      6
      
      <!-- ... -->
          <property>
              <name>hbase.zookeeper.property.clientPort</name>
              <value>2188</value>
          </property>
      <!-- ... -->
      
  2. 修改 Atlas 配置文件

    • 1
      2
      
      nano /opt/apps/atlas-1.2.0/conf/atlas-application.properties
      	# 有三处需要修改
      
    •  1
       2
       3
       4
       5
       6
       7
       8
       9
      10
      11
      12
      13
      14
      15
      16
      17
      18
      19
      20
      21
      22
      23
      24
      
      # ...
      
      #Hbase
      #For standalone mode , specify localhost
      #for distributed mode, specify zookeeper quorum here
      #atlas.graph.storage.hostname=localhost
      atlas.graph.storage.hostname=localhost:2188
      #atlas.graph.storage.hostname=node1:2181,node2:2181,node3:2181
      	# 这样配置不会启动内置的 hbase
      
      # ...
      
      #Solr
      #atlas.graph.index.search.solr.zookeeper-url=localhost:2181
      atlas.graph.index.search.solr.zookeeper-url=localhost:2188
      
      # ...
      
      #########  Entity Audit Configs  #########
      #atlas.audit.hbase.zookeeper.quorum=localhost:2181
      atlas.audit.hbase.zookeeper.quorum=localhost:2188
      	# 这行不改会导致后面网页访问报 503
      
      # ...
      
    • 如果只改前两处,Atlas 能够启动,HBase shell 下 list 命令能正常执行,Web 访问 Solr 也正常

      • 但网页访问 Atalas 会报 503

      • 日志里面能找到:

      • 1
        2
        3
        4
        5
        6
        
        2022-01-19 14:41:35,674 WARN  - [main:] ~ Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.context.event.internalEventListenerProcessor':
        ...
        2022-01-19 14:41:35,681 ERROR - [main:] ~ Context initialization failed (ContextLoader:350)
        org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.context.event.internalEventListenerProcessor': BeanPostProcessor before instantiation of bean failed
        ...
        Caused by: org.apache.hadoop.hbase.client.RetriesExhaustedException: Can't get the locations
        
      • 别问我是怎么找到解决方法的😫

相关内容