phoneix创建索引报错 Error: ERROR 1029 (42Y88): Mutable secondary indexes must have the hbase.regionserver.wal.codec

``

在Phoenix建立索引报如下错误

<p>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=MY_INDEX (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=MY_INDEX at org.apache.phoenix.exception.SQLExceptionCode$Factory$1.newException(SQLExceptionCode.java:494) at org.apache.phoenix.exception.SQLExceptionInfo.buildException(SQLExceptionInfo.java:150) at org.apache.phoenix.schema.MetaDataClient.createIndex(MetaDataClient.java:1524) at org.apache.phoenix.compile.CreateIndexCompiler$1.execute(CreateIndexCompiler.java:85) at org.apache.phoenix.jdbc.PhoenixStatement$2.call(PhoenixStatement.java:408) at org.apache.phoenix.jdbc.PhoenixStatement$2.call(PhoenixStatement.java:391) at org.apache.phoenix.call.CallRunner.run(CallRunner.java:53) at org.apache.phoenix.jdbc.PhoenixStatement.executeMutation(PhoenixStatement.java:389) at org.apache.phoenix.jdbc.PhoenixStatement.executeMutation(PhoenixStatement.java:378) at org.apache.phoenix.jdbc.PhoenixStatement.execute(PhoenixStatement.java:1825) at sqlline.Commands.execute(Commands.java:822) at sqlline.Commands.sql(Commands.java:732) at sqlline.SqlLine.dispatch(SqlLine.java:813) at sqlline.SqlLine.begin(SqlLine.java:686) at sqlline.SqlLine.start(SqlLine.java:398) at sqlline.SqlLine.main(SqlLine.java:291)</p>

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

**解决方案**:

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

hbase.regionserver.wal.codecorg.apache.hadoop.hbase.regionserver.wal.IndexedWALEditCodec

补充:
如果有 Ambari管理平台的直接前台修改,并在前台重启hbase;
后台修改xml文件,需要从后台重启hbase,否则修改不生效。

posted @ 2021-08-10 19:10  趴嘞怪  阅读(261)  评论(0编辑  收藏  举报