当我试图使用ruby客户端写到aerospike时,我得到了以下例外:-
特例::空运:不支持的服务器特性
详情:-
Aerospike version:- 4.3
Client: [Ruby] aerospike - 2.4.0
namespaces: NS1, NS2, NS3 注意: NS2和NS3具有单位真数据索引真。
代码(导致异常):-
client = Aerospike::Client.new('aerospike:3000')
key = Aerospike::Key.new('NS2', 'set name', 'this is the key')
data = { 'record' => 1 }
client.put(key, data) # this line raises the exception
Aerospike::Exceptions::Aerospike: Unsupported Server Feature如果我将NS2键更改为NS1,则不会引发异常。
发布于 2018-09-13 03:01:38
您所得到的“不支持的服务器功能”错误是因为Ruby客户端默认将用户密钥发送到服务器,但是Aerospike服务器不支持存储内存中的数据和单桶设置的用户密钥。您应该在服务器日志中看到这样的错误消息:
Sep 13 2018 02:42:20 GMT: WARNING (rw): (rw_utils.c:153) {sbin} can't store key if data-in-memory & single-bin您需要通过将send_key写策略设置设置为false来禁用发送键作为put请求的一部分
$ bundle exec irb
2.5.0 :001 > require 'aerospike'; include Aerospike;
=> Object
2.5.0 :002 > client = Client.new; key = Key.new('sbin', 'test', 'foo'); nil
=> nil
2.5.0 :003 > client.put(key, Bin.new('', 42), send_key: false)
=> nil
2.5.0 :004 > client.get(key).bins['']
=> 42https://stackoverflow.com/questions/52294841
复制相似问题