GeoMesa-Hbase单机环境安装
1.安装前准备
软件准备
- apache-zookeeper-3.5.7-bin.tar.gz
- hbase-2.3.4-bin.tar.gz
- geomesa-hbase_2.11-3.1.0-bin.tar.gz
- geomesa-tutorials-hbase-quickstart-3.2.0-SNAPSHOT.jar
修改主机名称
hostnamectl set-hostname master
vim /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.0.106 master
2.安装zookeeper
1.解压文件
tar -zxvf apache-zookeeper-3.5.7-bin.tar.gz -C /usr/local/
2.修改配置文件
cd /usr/local/zookeeper
cp -r zoo.sample.cfg zoo.cfg
vi zoo.cg
添加如下配置:
dataDir=/usr/local/zookeeper/data
dataLogDir=/usr/local/zookeeper/log
3.启动zookeeper
cd /usr/local/zookeeper/bin
./zkServer.sh start
3.安装Hbase
1.解压文件
tar -zxvf hbase-2.3.4-bin.tar.gz -C /usr/local/
2.修改配置文件
cd /usr/local/hbase-2.3.4/conf/
vi hbase-env.sh
添加如下配置:
export JAVA_HOME=/usr/local/jdk1.8.0_221
export HBASE_MANAGES_ZK=false #启用外部zookeeper
编辑hbase-site.xml:
<property>
<name>hbase.cluster.distributed</name>
<value>true</value>
</property>
<property>
<name>hbase.tmp.dir</name>
<value>./tmp</value>
</property>
<property>
<name>hbase.unsafe.stream.capability.enforce</name>
<value>false</value>
</property>
<property>
<name>hbase.rootdir</name>
<value>file:///usr/local/hbase-2.3.4/rootdir</value>
</property>
<property>
<name>hbase.zookeeper.property.dataDir</name>
<value>/usr/local/zookeeper/data</value>
</property>
<property>
<name>hbase.zookeeper.quorum</name>
<value>localhost</value>
</property>
<!-- ZooKeeper存储hbase数据的节点名称 -->
<property>
<name>zookeeper.znode.parent</name>
<value>/hbase</value>
</property>
<property>
<name>hbase.coprocessor.user.region.classes</name>
<value>org.locationtech.geomesa.hbase.server.coprocessor.GeoMesaCoprocessor</value>
</property>
3.配置环境变量: vi /etc/profile
#Set Java Enviornment
export JAVA_HOME=/usr/local/jdk1.8.0_221
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
#Set Hadoop Enviornment
export HADOOP_HOME=/usr/local/hadoop-2.8.5
PATH=$PATH:$HOME/.local/bin:$HOME/bin:$HADOOP_HOME/bin:$HADOOP_HOME/sbin
export PATH
export HBASE_HOME=/usr/local/hbase-2.3.4
export PATH=$PATH:$HBASE_HOME/bin
export GEOMESA_HBASE_HOME=/usr/local/geomesa-hbase_2.11-3.1.0
export PATH=$PATH:$GEOMESA_HBASE_HOME/bin
4.安装geomesa-hbase
1.解压文件
tar -zxvf geomesa-hbase_2.11-3.1.0-bin.tar.gz -C /usr/local/
2.安装依赖
cd /usr/local/geomesa-hbase_2.11-3.1.0/bin
./install-dependencies.sh
3.拷贝jar包至hbase lib安装目录下
cp -r /usr/local/geomesa-hbase_2.11-3.1.0/dist/hbase/geomesa-hbase-distributed-runtime-hbase2_2.11-3.1.0.jar /usr/local/hbase-2.3.4/lib/
5.验证安装
1.启动hbase
start-hbse.sh
java -cp geomesa-tutorials-hbase-quickstart-3.2.0-SNAPSHOT.jar org.geomesa.example.hbase.HBaseQuickStart --hbase.zookeepers localhost --hbase.catalog test_liutao
2.成功信息如下所示
Loading datastore
Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
Creating schema: GLOBALEVENTID:String,Actor1Name:String,Actor1CountryCode:String,Actor2Name:String,Actor2CountryCode:String,EventCode:String,NumMentions:Integer,NumSources:Integer,NumArticles:Integer,ActionGeo_Type:Integer,ActionGeo_FullName:String,ActionGeo_CountryCode:String,dtg:Date,geom:Point:srid=4326
Generating test data
Writing test data
Wrote 2356 features
Running query BBOX(geom, -120.0,30.0,-75.0,55.0) AND dtg DURING 2017-12-31T00:00:00+00:00/2018-01-02T00:00:00+00:00
01 719026370=719026370|MEXICO|MEX|UNITED STATES|USA|193|4|1|4|3|Imperial Beach, California, United States|US|2018-01-01T00:00:00.000Z|POINT (-117.113 32.5839)
02 719025493=719025493|CIVILIAN||||013|5|1|5|3|San Diego, California, United States|US|2018-01-01T00:00:00.000Z|POINT (-117.157 32.7153)
03 719025402=719025402|POLICE||||112|5|1|5|3|Camp Pendleton, California, United States|US|2018-01-01T00:00:00.000Z|POINT (-117.393 33.2103)
04 719027018=719027018|UNITED STATES|USA|||190|2|1|2|3|Camp Pendleton, California, United States|US|2018-01-01T00:00:00.000Z|POINT (-117.393 33.2103)
05 719026757=719026757|RUSSIA|RUS|UKRANIAN||042|2|1|2|3|Irvine, California, United States|US|2018-01-01T00:00:00.000Z|POINT (-117.823 33.6695)
06 719027129=719027129|UNITED STATES|USA|ISRAELI|ISR|145|1|1|1|3|Irvine, California, United States|US|2018-01-01T00:00:00.000Z|POINT (-117.823 33.6695)
07 719027131=719027131|UNITED STATES|USA|ISRAEL|ISR|145|2|1|2|3|Irvine, California, United States|US|2018-01-01T00:00:00.000Z|POINT (-117.823 33.6695)
08 719026319=719026319|SENATOR||UNITED STATES|USA|051|2|1|2|2|Texas, United States|US|2018-01-01T00:00:00.000Z|POINT (-97.6475 31.106)
09 719027007=719027007|MASSACHUSETTS|USA|||172|7|1|4|2|Texas, United States|US|2018-01-01T00:00:00.000Z|POINT (-97.6475 31.106)
10 719027101=719027101|MICHIGAN|USA|UNIVERSITY||084|20|2|20|2|Texas, United States|US|2018-01-01T00:00:00.000Z|POINT (-97.6475 31.106)
Returned 669 total features
Running query BBOX(geom, -120.0,30.0,-75.0,55.0) AND dtg DURING 2017-12-31T00:00:00+00:00/2018-01-02T00:00:00+00:00
Returning attributes [GLOBALEVENTID, dtg, geom]
01 719025273=719025273|2018-01-01T00:00:00.000Z|POINT (-75.7 45.4167)
02 719025300=719025300|2018-01-01T00:00:00.000Z|POINT (-75.7 45.4167)
03 719025742=719025742|2018-01-01T00:00:00.000Z|POINT (-117.157 32.7153)
04 719025915=719025915|2018-01-01T00:00:00.000Z|POINT (-117.157 32.7153)
05 719025400=719025400|2018-01-01T00:00:00.000Z|POINT (-117.393 33.2103)
06 719025135=719025135|2018-01-01T00:00:00.000Z|POINT (-117.823 33.6695)
07 719026216=719026216|2018-01-01T00:00:00.000Z|POINT (-97.6475 31.106)
08 719026312=719026312|2018-01-01T00:00:00.000Z|POINT (-97.6475 31.106)
09 719026320=719026320|2018-01-01T00:00:00.000Z|POINT (-97.6475 31.106)
10 719026992=719026992|2018-01-01T00:00:00.000Z|POINT (-97.6475 31.106)
Returned 669 total features
Running query EventCode = '051'
01 719024909=719024909|||MELBOURNE|AUS|051|10|1|10|4|Melbourne, Victoria, Australia|AS|2018-01-01T00:00:00.000Z|POINT (144.967 -37.8167)
02 719025178=719025178|AUSTRALIA|AUS|COMMUNITY||051|20|2|20|4|Sydney, New South Wales, Australia|AS|2018-01-01T00:00:00.000Z|POINT (151.217 -33.8833)
03 719025965=719025965|MIDWIFE||||051|10|1|10|4|Sydney, New South Wales, Australia|AS|2018-01-01T00:00:00.000Z|POINT (151.217 -33.8833)
04 719025509=719025509|COMMUNITY||AUSTRALIA|AUS|051|2|1|2|1|Australia|AS|2018-01-01T00:00:00.000Z|POINT (135 -25)
05 719025742=719025742|KING||||051|22|3|22|3|San Diego, California, United States|US|2018-01-01T00:00:00.000Z|POINT (-117.157 32.7153)
06 719025745=719025745|KING||||051|4|2|4|2|California, United States|US|2018-01-01T00:00:00.000Z|POINT (-119.746 36.17)
07 719025743=719025743|AUTHORITIES||||051|60|12|60|3|Wichita, Kansas, United States|US|2018-01-01T00:00:00.000Z|POINT (-97.3375 37.6922)
08 719027205=719027205|UNITED STATES|USA|SIOUX||051|4|1|4|3|Sioux City, Iowa, United States|US|2018-01-01T00:00:00.000Z|POINT (-96.4003 42.5)
09 719025111=719025111|||UNITED STATES|USA|051|2|1|2|3|Pickens County, South Carolina, United States|US|2018-01-01T00:00:00.000Z|POINT (-82.7165 34.9168)
10 719026938=719026938|PITTSBURGH|USA|||051|5|1|5|3|York County, Pennsylvania, United States|US|2018-01-01T00:00:00.000Z|POINT (-77 40.1254)
Returned 138 total features
Running query EventCode = '051' AND dtg DURING 2017-12-31T00:00:00+00:00/2018-01-02T00:00:00+00:00
Returning attributes [GLOBALEVENTID, dtg, geom]
01 719025634=719025634|2018-01-01T00:00:00.000Z|POINT (178 -18)
02 719027116=719027116|2018-01-01T00:00:00.000Z|POINT (-117.157 32.7153)
03 719027117=719027117|2018-01-01T00:00:00.000Z|POINT (-119.746 36.17)
04 719025036=719025036|2018-01-01T00:00:00.000Z|POINT (-86.8073 32.799)
05 719026318=719026318|2018-01-01T00:00:00.000Z|POINT (-86.8073 32.799)
06 719026296=719026296|2018-01-01T00:00:00.000Z|POINT (-81.2793 33.4968)
07 719025744=719025744|2018-01-01T00:00:00.000Z|POINT (-77.0364 38.8951)
08 719026946=719026946|2018-01-01T00:00:00.000Z|POINT (-86.2604 39.8647)
09 719025279=719025279|2018-01-01T00:00:00.000Z|POINT (-80.1667 44.0833)
10 719027252=719027252|2018-01-01T00:00:00.000Z|POINT (-77.264 40.5773)
Returned 138 total features
Done