空间数据库系列一:geomesa&sparksql 分析环境搭建

geomesa sparksql 分析环境搭建

1、安装hbase-1.3.2.1 standlone版本,作为geomesa的store

a、修改配置文件:hbase-1.3.2.1/conf/hbase-site.xml

 <property>
    <name>hbase.rootdir</name>
    <value>/home/qingzhi.lzp/hbase-1.3.2.1/data</value>
  </property>
  <property>
        <name>hbase.zookeeper.quorum</name>
        <value>localhost</value>
  </property>

  <property>
    <name>hbase.zookeeper.property.dataDir</name>
    <value>/tmp/zookeeper</value>
  </property>
  <property>
     <name>hbase.cluster.distributed</name>
     <value>true</value>
  </property>
  <property>
    <name>hbase.unsafe.stream.capability.enforce</name>
    <value>false</value>
    <description>
      likely not a false positive.
    </description>
  </property>

  <property>
    <name>hbase.coprocessor.user.region.classes</name>
    <value>org.locationtech.geomesa.hbase.coprocessor.GeoMesaCoprocessor</value>
  </property>

b、修改配置文件: hbase-env.sh ,增加JAVA_HOME配置

export JAVA_HOME=path

c、geomesa-hbase-distributed-runtime_2.11-2.0.2.jar 部署到hbase的lib目录:

cp geomesa-hbase-distributed-runtime_2.11-2.0.2.jar ~/hbase-1.3.2.1/lib/

d、启动hbase

cd hbase-1.3.2.1/bin
./start-hbase.sh
2、安装zookeeper-3.4.10 standlone版本

a、增加zookeeper配置

cd zookeeper-3.4.10/conf
cp zoo_sample.cfg zoo.cfg

b、启动zookeeper

cd zookeeper-3.4.10/bin
zkServer.sh start

c、查看hase是否注册成功

./zkCli.sh
[zk: localhost:2181(CONNECTED) 0] ls /
[zookeeper, hbase]
3、命令行工具安装 geomesa-hbase_2.11-2.0.2-bin.tar.gz

a、进入目录执行安装命令

cd geomesa-hbase_2.11-2.0.2
$ bin/install-jai.sh
$ bin/install-jline.sh

b、导入gdelt数据到hbase

/bin/geomesa-hbase ingest --catalog gdeltable --feature-name gdelt --converter gdelt2 --spec gdelt2 /home/qingzhi.lzp/20180101.tsv
Error while parsing JAI registry file "file:/home/qingzhi.lzp/hbase-1.3.2.1/lib/geomesa-hbase-distributed-runtime_2.11-2.0.2.jar!/META-INF/registryFile.jai" :
Error in registry file at line number #31
A descriptor is already registered against the name "org.geotools.ColorReduction" under registry mode "rendered"
Error in registry file at line number #32
A descriptor is already registered against the name "org.geotools.ColorInversion" under registry mode "rendered"
INFO  Creating schema 'gdelt'
INFO  Running ingestion in local mode
INFO  Ingesting 1 file with 1 thread
[============================================================] 100% complete 79119 ingested 0 failed in 00:00:12
INFO  Local ingestion complete in 00:00:12
INFO  Ingested 79119 features with no failures.

c、查看hbase里面的数据

hbase(main):001:0> list
TABLE                                                                                                                            
gdeltable                                                                                                                        
gdeltable_gdelt_id                                                                                                               
gdeltable_gdelt_z2_v2                                                                                                            
gdeltable_gdelt_z3_v2                                                                                                            
4 row(s) in 0.2630 seconds

=> ["gdeltable", "gdeltable_gdelt_id", "gdeltable_gdelt_z2_v2", "gdeltable_gdelt_z3_v2"]
hbase(main):002:0>

至此,说明数据导入完成,后面主要对导入的数据使用spark进行分析。

4、安装spark

下载spark-2.3.1-bin-hadoop2.7,解压。
无需启动sparkserver,ln -s spark-2.3.1-bin-hadoop2.7
.bashrc 配置spark home

export SPARK_HOME=/home/qingzhi.lzp/spark
export PATH=$PATH:$SPARK_HOME/bin:$SPARK_HOME/sbin

5、安装hadoop

下载hbase-1.3.2.1-bin.tar.gz,解压.
修改配置文件:hadoop-3.0.3/etc/hadoop/core-site.xml,增加:

<configuration>
    <property>
        <name>fs.defaultFS</name>
        <value>hdfs://localhost:9000</value>
    </property>
</configuration>

修改配置文件:hadoop-3.0.3/etc/hadoop/hdfs-site.xml,增加:

<configuration>
    <property>
        <name>dfs.replication</name>
        <value>1</value>
    </property>
</configuration>

修改配置文件:hadoop-3.0.3/etc/hadoop/hadoop-env.sh,增加:

export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.65-3.b17.1.alios7.x86_64/jre

.bashrc 配置spark home

export HADOOP_HOME=/home/qingzhi.lzp/hadoop-3.0.3
export PATH=$PATH:$HADOOP_HOME/bin

6、安装zeppelin可视化工具

a、安装zeppelin-0.8.0-bin-all.tgz版本

解压后直接启动
zeppelin-0.8.0-bin-all/bin/zeppelin-daemon.sh start

b、web页面访问,进行配置

image

配置interpreter:

image

c、使用spark进行分析:

image

查询hbase表数据:

image

通过上面一系列配置,可以在zeppelin上通过spark sql对hbase里面的时空数据进行分析。

转载于:https://www.cnblogs.com/happyliu/p/9572728.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值