HDFS handler


1.hive support
12.2取消了hive handler,因为hdfs handler已经提供了之前hive handler的功能。

2.指定hdfs文件格式为Sequence File
2.1结合hive
CREATE EXTERNAL TABLE table_name (
  col1 string,
  ...
  ...
  col2 string)
ROW FORMAT DELIMITED
STORED as sequencefile
LOCATION '/path/to/hdfs/file';
注意:使用hive时,gg.handler.name.partitionByTable必须设置为true(默认)

2.2数据格式
关于数据格式详细的设置在Delimited Text Formatter
例子:
gg.handler.name.format=sequencefile
gg.handler.name.format.includeColumnNames=true
gg.handler.name.format.includeOpType=true
gg.handler.name.format.includeCurrentTimestamp=true
gg.handler.name.format.updateOpKey=U
3.运行前的设置
2.4.1 classpath的设置
两个配置必须被加入classpath中:core-site.xml和hdfs客户端jar包
  1. The default location of the core-site.xml file is the follow: #core-site.xml文件
  2. Hadoop_Home/etc/hadoop

  3. The default location of the HDFS client jars are the following directories: #hdfs客户端位置
  4. Hadoop_Home/share/hadoop/common/lib/*
  5. Hadoop_Home/share/hadoop/common/*
  6. Hadoop_Home/share/hadoop/hdfs/lib/*
  7. Hadoop_Home/share/hadoop/hdfs/*
例子:
  1. gg.classpath=/ggwork/hadoop/hadoop-2.6.0/etc/hadoop:/ggwork/hadoop/hadoop-2.6.0/share/hadoop/common/lib/*:/ggwork/hadoop/hadoop-2.6.0/share/hadoop/common/*:/ggwork/hadoop/hadoop-2.6.0/share/hadoop/hdfs/*:/ggwork/hadoop/hadoop-2.6.0/share/hadoop/hdfs/lib/*
注意:严格按照上面的配置来。croe-site.xml文件的目录不能加*,jar的不能使用*.jar

2.4.2 支持多种文字格式化程序
    文字格式化程序将tril 文件转化为格式的信息。支持以下:
      JSON
Delimited Text
Avro Row
Avro Operation
Avro Object Container File Row
Avro Object Container File Operation
XML

2.4.3 hdfs的配置
    参考:
http://docs.oracle.com/goldengate/bd1221/gg-bd/GADBD/GUID-85A82B2E-CD51-463A-8674-3D686C3C0EC0.htm#GADBD383

2.4.4 示例配置
gg.handlerlist=hdfs
gg.handler.hdfs.type=hdfs
gg.handler.hdfs.mode=tx
gg.handler.hdfs.includeTokens=false
gg.handler.hdfs.maxFileSize=1g
gg.handler.hdfs.rootFilePath=/ogg
gg.handler.hdfs.fileRollInterval=0
gg.handler.hdfs.inactivityRollInterval=0
gg.handler.hdfs.fileSuffix=.txt
gg.handler.hdfs.partitionByTable=true
gg.handler.hdfs.rollOnMetadataChange=true
gg.handler.hdfs.authType=none
gg.handler.hdfs.format=delimitedtext

2.4.5 troubleshoting 
(1)日志
OGG FOR BIGDATA的数据流向是 Replicat Process >User Exit > Java Layer,可以以java层面设置日志。日志在dirrpt目录下 

在hdfs.props中设置,可以控制日志级别
gg.log=log4j
gg.log.level=INFO
支持以下级别:
OFF
FATAL
ERROR
WARN
INFO
DEBUG
TRACE

安装时初始化了三个log4j的配置文件并且加入了环境变量中:
log4j-default.properties
log4j-debug.properites
log4j-trace.properties
可以在启动时设置log4j的属性:
javawriter.bootoptions=-Xmx512m -Xms64m -Djava.class.path=.:ggjava/ggjava.jar -Dlog4j.configuration=samplelog4j.properties



















原文地址:https://www.cnblogs.com/skyrim/p/7456184.html