aerospike - 访问二级索引 Aerospike_ERR_INDEX_NOT_READABLE 时 Aerospike 出错
问题描述
当我尝试访问二级索引时,Aerospike 抛出 AEROSPIKE_ERR_INDEX_NOT_READABLE 错误。使用以下语法创建索引
CREATE INDEX index_id ON test.class (id) STRING;
任何建议将不胜感激。
解决方案
aql> create index id1 on ns1.testset (1) string;
OK, 1 index added.
aql> show indexes
+-------+-----+-----------+-----------+-------+-----------+------+----------+
| ns | bin | indextype | set | state | indexname | path | type |
+-------+-----+-----------+-----------+-------+-----------+------+----------+
| "ns1" | "1" | "NONE" | "testset" | "WO" | "id1" | "1" | "STRING" |
+-------+-----+-----------+-----------+-------+-----------+------+----------+
[127.0.0.1:3000] 1 row in set (0.001 secs)
+-------+-----+-----------+-----------+-------+-----------+------+----------+
| ns | bin | indextype | set | state | indexname | path | type |
+-------+-----+-----------+-----------+-------+-----------+------+----------+
| "ns1" | "1" | "NONE" | "testset" | "WO" | "id1" | "1" | "STRING" |
+-------+-----+-----------+-----------+-------+-----------+------+----------+
[172.14.10.12:3000] 1 row in set (0.002 secs)
OK
aql> show indexes
+-------+-----+-----------+-----------+-------+-----------+------+----------+
| ns | bin | indextype | set | state | indexname | path | type |
+-------+-----+-----------+-----------+-------+-----------+------+----------+
| "ns1" | "1" | "NONE" | "testset" | "RW" | "id1" | "1" | "STRING" |
+-------+-----+-----------+-----------+-------+-----------+------+----------+
[127.0.0.1:3000] 1 row in set (0.001 secs)
+-------+-----+-----------+-----------+-------+-----------+------+----------+
| ns | bin | indextype | set | state | indexname | path | type |
+-------+-----+-----------+-----------+-------+-----------+------+----------+
| "ns1" | "1" | "NONE" | "testset" | "RW" | "id1" | "1" | "STRING" |
+-------+-----+-----------+-----------+-------+-----------+------+----------+
[172.14.10.12:3000] 1 row in set (0.002 secs)
OK
注意:1)创建索引时不需要分号,但不会抛出错误。所以:
aql> create index id1 on ns1.testset (1) string
将是正确的方法。2) 一旦您发出创建索引的命令,根据数据大小,构建 SI 需要时间。检查状态:WO --> 索引尚不可读,但您可以插入记录,它们将被索引。当状态变为“RW”——读/写——你可以进行 SI 查询。
您不必重新启动 Aerospike 服务器。
推荐阅读
- file-io - 文件 I/O 中的分段错误,无法确定
- java - 如何使用 jax-rs 发送 x-www-form-url-encoded 请求?
- wpf - UserControl的DataContext:直接设置为viewmodel
- javascript - 将 Nodejs 部署到 Heroku:babel 出错(es6)
- css - 登录作为登录屏幕左下角的单独窗口打开
- java - Jazz RTC Java API:如何按名称查找项目区域
- tensorflow - Tensorflow from_generator 拟合时输入不足
- html - 当光标触摸主侧菜单时,子菜单应该可见
- javascript - 如何使用不同的js文件而不是用HTML编写快递
- flutter - 如何在 Dart 中将列表缩减为最早/最新的 DateTime 项 - 你知道有趣的代码问题类型