在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添加以下语句:
<property>
<name>hbase.regionserver.wal.codec</name>
<value>org.apache.hadoop.hbase.regionserver.wal.IndexedWALEditCodec</value>
</property>
重启hbase即可
再重新建索引,可以看到索引已经成功建立并且使用上