`
han.zoo
  • 浏览: 25761 次
  • 性别: Icon_minigender_1
  • 来自: 杭州
最近访客 更多访客>>
社区版块
存档分类
最新评论

HBase replication 建立

阅读更多

HBase replication建立

官方文档   http://hbase.apache.org/apidocs/org/apache/hadoop/hbase/replication/package-summary.html#requirements

  http://hbase.apache.org/replication.html

 

参考:http://www.infoq.com/cn/articles/lp-hbase-data-disaster-recovery

Zookeeper should be handled by yourself, not by HBase, and should always be available during the deployment.

1.zookeeper不用hbase管理 修改hbase-env.sh

export HBASE_MANAGES_ZK=false

2.安装zookeeper 下载zookeeper 解压zookeeper

创建文件/hadoopDATA/zookeeper(根据配置文件dataDir)

每台zookeeper机器

建立/hadoopDATA/zookeeper/myid文件并根据

server.1=192.168.40.240:2888:3888
server.2=192.168.40.246:2888:3888
server.3=192.168.40.247:2888:3888
server.4=
192.168.40.248:2888:3888

写入1,2,3,4等

192.168.40.240机器的myid=1

192.168.40.246机器的myid=2

编辑zoo.cfg


dataDir=/hadoopDATA/zookeeper

server.1=192.168.40.240:2888:3888
server.2=192.168.40.246:2888:3888
server.3=192.168.40.247:2888:3888
server.4=192.168.40.248:2888:3888

3.copy zoo.cfg 至/hbase/conf文件夹下

copy zookeeper至各服务器,并创建文件/hadoopDATA/zookeeper/myid,根扰配置文件分别写入各个值

scp -r zookeeper-3.4.3/ hadoop@slave1:/home/hadoop/

scp -r zookeeper-3.4.3/ hadoop@slave2:/home/hadoop/

scp -r zookeeper-3.4.3/ hadoop@slave3:/home/hadoop/

4.启动zookeeper验证是否正常

zookeeper目录下各服务器分别启动zookeeper

./bin/zkServer.sh

All machines from both clusters should be able to reach every other machine since replication goes from any region server to any other one on the slave cluster. That also includes the Zookeeper clusters.

两个集群间机器互联没问题(ssh master,ssh slave1,ssh salve2,ssh slave3)

Both clusters should have the same HBase and Hadoop major revision. For example, having 0.90.1 on the master and 0.90.0 on the slave is correct but not 0.90.1 and 0.89.20100725.

版本保持一致

Every table that contains families that are scoped for replication should exist on every cluster with the exact same name, same for those replicated families.

两个cluster间的表结构需要保持一致

For multiple slaves, Master/Master, or cyclic replication version 0.92 or greater is needed.

测试环境

两个集群zookeeper handled not by hbase

编辑hbase-env.conf

export HBASE_MANAGES_ZK=false

两集群的zookeeper.znode.parent要不一致,hbase默认会创建/hbase/,cluster 2在hbase-site.xml 指定zookeeper.znode.parent为/hbase-2

1.cluster 1分布式Hbase环境

hadoop namenode(master),datanode(master,slave1,slave2)

HBase

HMaster(master),regionserver(master,slave1,slave2)

2.cluster2 Pseudo-distributed Hbase

hadoop配置文件

hdfs-site.xml

<configuration>
<property>
<name>dfs.name.dir</name>
<value>/hadoopDATA/name</value>
</property>
<property>
<name>dfs.data.dir</name>
<value>/hadoopDATA/data</value>
</property>
<property>
<name>fs.replication</name>
<value>1</value>
</property>
</configuration>

core-site.xml

<configuration>
<!-- global properties -->
<property>
<name>hadoop.tmp.dir</name>
<value>/root/hadoopDATA/tmp</value>
</property>
<!-- file system properties -->
<property>
<name>fs.default.name</name>
<value>hdfs://slave3:9000</value>
</property>
</configuration>

masters

slave3

slaves

slave3

Hbase 配置文件

hbase-site.xml

<configuration>
<property>
<name>hbase.rootdir</name>
<value>hdfs://slave3:9000/hbase3</value>
</property>
<property>
<name>hbase.cluster.distributed</name>
<value>true</value>
</property>
<property>
<name>hbase.master</name>
<value>slave3:60000</value>
</property>
<property>
<name>hbase.zookeeper.quorum</name>
<value>slave3</value>
</property>
<property>
<name>hbase.replication</name>
<value>true</value>
</property>
<property>
<name>zookeeper.znode.parent</name>
<value>/hbase-2</value>

</property>

regionservers

localhost

建立replication

1.Edit ${HBASE_HOME}/conf/hbase-site.xml on both cluster to add the following configurations:

<property>
  <name>hbase.replication</name>
  <value>true</value>
</property>

deploy the files, and then restart HBase if it was running.

2.add_peer '7', "slave3:2181:/hbase-2"

报错,实际使用中没有影响

hbase(main):004:0> add_peer '7' ,"slave3:2181:/hbase-2"
12/03/02 15:04:43 ERROR zookeeper.RecoverableZooKeeper: Node /hbase/replication/peers already exists and this is not a retry
0 row(s) in 0.0650 seconds

3.Once you have a peer, you need to enable replication on your column families. One way to do it is to alter the table and to set the scope like this:

      disable 'your_table'
      alter 'your_table', {NAME => 'family_name', REPLICATION_SCOPE => '7
'}
      enable 'your_table'
  两个cluster的表存在且结构相同
 

4.开启停止复制

start_replication
stop_replication
分享到:
评论

相关推荐

    Elasticsearch-HBase-replication同步

    用于hbase同步数据到es(replication机制)

    HBase 应用平台 Replication 功能

    NULL 博文链接:https://57832638.iteye.com/blog/1978504

    HbaseTemplate 操作hbase

    java 利用 sping-data-hadoop HbaseTemplate 操作hbase find get execute 等方法 可以直接运行

    hbase-1.4.9-bin.tar.gz

    HBase是建立在Hadoop文件系统之上的分布式面向列的数据库。它是一个开源项目,是横向扩展的。 HBase是一个数据模型,类似于谷歌的大表设计,可以提供快速随机访问海量结构化数据。它利用了Hadoop的文件系统(HDFS)...

    2-1-HBase.pdf

    HBase是建立在Hadoop文件系统之上的分布式面向列的数据库。它是一个开源项目,是横向扩展的。 HBase是一个数据模型,类似于谷歌的大表设计,可以提供快速随机访问海量结构化数据。它利用了Hadoop的文件系统(HDFS)...

    pinpoint的hbase初始化脚本hbase-create.hbase

    搭建pinpoint需要的hbase初始化脚本hbase-create.hbase

    hbase-custom-replication-endpoint-example:hbase-custom-replication-endpoint-example

    将 hbase.replication=true 添加到 hbase-site.xml 将 jar 复制到每个区域服务器上的 lib 目录 重启区域服务器 java -cp $(hbase classpath):target/hbase-custom-replication-endpoint-example-1.0-SNAPSHOT.jar ...

    HBase数据库设计.doc

    1. HBase有哪些基本的特征? 1 HBase特征: 1 2. HBase相对于关系数据库能解决的问题是什么? 2 HBase与关系数据的区别? 2 HBase与RDBMS的区别? 2 3. HBase的数据模式是怎么样的?即有哪些元素?如何存储?等 3 1...

    hbase-0.90.2中创建表、插入数据,更新数据,删除数据

    假设有一个不知道是干什么表:) 表里需要存入人员和其相对应的部门信息 HBaseAdmin admin = new HBaseAdmin(configuration); List&lt;Put&gt; putuser = new ArrayList();

    HBase(hbase-2.4.9-bin.tar.gz)

    HBase(hbase-2.4.9-bin.tar.gz)是一个分布式的、面向列的开源数据库,该技术来源于 Fay Chang 所撰写的Google论文“Bigtable:一个结构化数据的分布式存储系统”。就像Bigtable利用了Google文件系统(File System...

    实验三:熟悉常用的HBase操作

    A.3实验三:熟悉常用的HBase操作 本实验对应第5章的内容。 A.3.1 实验目的 (1)理解HBase在Hadoop体系结构中的角色。(2)熟练使用HBase操作常用的 Shell命令。(3)熟悉HBase操作常用的 Java API。 A.3.2 实验平台 (1...

    Hbase 二级索引方案

    入、更新或删除操作时,Indexer 通过 HBase 的 replication 功能来把这些操作抽象成一系 列的 Event 事件,并用来保证写入 Solr 中的 HBase 索引数据的一致性。并且 Indexer 支持 用户自定义的抽取,转换规则来索引 ...

    hbase-sdk是基于hbase-client和hbase-thrift的原生API封装的一款轻量级的HBase ORM框架

    hbase-sdk是基于hbase-client和hbase-thrift的原生API封装的一款轻量级的HBase ORM框架。 针对HBase各版本API(1.x~2.x)间的差异,在其上剥离出了一层统一的抽象。并提供了以类SQL的方式来读写HBase表中的数据。对...

    HBase学习利器:HBase实战

    HBase开发实战,HBase学习利器:HBase实战

    Hbase资源整理集合

    HBase 官方文档.pdf HBase的操作和编程.pdf HBase Cpressr优化与实验 郭磊涛.pdf null【HBase】Data Migratin frm Gri t Clu Cmputing - Natural Sienes .pdf 分布式数据库HBase快照的设计与实现.pdf 【HBase】...

    java大数据作业_3HBase

    1. 请用java集合的代码描述HBase的表结构 2. 请简述HBase中数据写入最后导致Region分裂的全过程 3. 如果设计一个笔记的表,表中要求有笔记的属性和笔记的内容,怎么做 4. HBase部署时如何指定多个zookeeper 5. HBase...

    HBase开启审计日志

    HBase开启审计日志

    hbase-2.3.5单机一键部署工具

    注意:zookeeper3.4.13和hbase2.3.5都是采用docker-compose方式部署 原文链接:https://blog.csdn.net/m0_37814112/article/details/120915194 说明:使用外部zookeeper3.4.13之hbase2.3.5一键部署工具,支持部署、...

    hbase资料api

    HBASE

Global site tag (gtag.js) - Google Analytics