Phoenix 建立二级索引报错:Mutable secondary indexes must have the hbase.regionserver.wal.codec property

在Phoenix建立二级索引

create index test1_name on "test1"("cf1"."name") include("cf1"."age");

Error: ERROR 1029 (42Y88): Mutable secondary indexes must have the hbase.regionserver.wal.codec property set to org.apache.hadoop.hbase.regionserver.wal.IndexedWALEditCodec in the hbase-sites.xml of every region server. tableName=TEST1_NAME (state=42Y88,code=1029)
java.sql.SQLException: ERROR 1029 (42Y88): Mutable secondary indexes must have the hbase.regionserver.wal.codec property set to org.apache.hadoop.hbase.regionserver.wal.IndexedWALEditCodec in the hbase-sites.xml of every region server. tableName=TEST1_NAME

原因:
hbase可变索引默认没有开启

解决方案:

在 每个regionServer的hbase-site.xml添加以下语句:

 
  hbase.regionserver.wal.codec 
  org.apache.hadoop.hbase.regionserver.wal.IndexedWALEditCodec 

重启hbase即可

再重新建索引,可以看到索引已经成功建立并且使用上

Phoenix 建立二级索引报错:Mutable secondary indexes must have the hbase.regionserver.wal.codec property_第1张图片

你可能感兴趣的:(Hadoop)