This means the consistency sub-system is not enabled/active. You can verify this with the output of `riak-admin ensemble-status`.
To enable strong consistency you must: 1) Set 'strong_consistency = on' in riak.conf. 2) Have at least a 3 node cluster. You can address #2 by setting up 3+ local developer nodes as detailed in the 5 minute tutorial: http://docs.basho.com/riak/2.0.0/quickstart Alternatively, you can override the need for 3 nodes and use 1 node. To do that, 1) Run 'riak attach' to attach to your Riak's node console 2) Enter (including the period): riak_ensemble_manager:enable(). 3) Enter (including the period): riak_core_ring_manager:force_update(). 3) Detach from the console using: Ctrl-C a After either approach, re-check `riak-admin ensemble-status`. It may take up to a minute for the consistency sub-system to be enabled. If you haven't already, please take a look at the temporary (until we finish updating docs.basho.com) strong consistency related documentation (linked from the 2.0 RC1 release notes) here: https://github.com/basho/riak_ensemble/blob/wip/riak-2.0-user-docs/riak_consistent_user_docs.md Regards, Joe On Mon, Jul 28, 2014 at 3:05 PM, Jason W <[email protected]> wrote: > Hi, > > I am trying out 2.0 w/ just one local node, created a strongly consistent > bucket type. But keep getting below exception. If I just use the default > bucket type, everything works fine. Here is the bucket type detail with > consistency bit on. > > young_vclock: 20 > w: quorum > small_vclock: 50 > rw: quorum > r: quorum > pw: 0 > precommit: [] > pr: 0 > postcommit: [] > old_vclock: 86400 > notfound_ok: true > n_val: 1 > linkfun: {modfun,riak_kv_wm_link_walker,mapreduce_linkfun} > last_write_wins: false > dw: quorum > dvv_enabled: true > chash_keyfun: {riak_core_util,chash_std_keyfun} > big_vclock: 50 > basic_quorum: false > allow_mult: true > consistent: true > active: true > claimant: '[email protected]' > > Here is the java code > > List<String> addresses = new LinkedList<String>(); > > addresses.add("172.16.0.254"); > > RiakClient riakClient = RiakClient.newClient(addresses); > > try { > > Location wildeGeniusQuote = new Location(new > Namespace("strongly_consistent2", "sample"), emp.getId()); > > BinaryValue text = > BinaryValue.create(objectMapper.writeValueAsBytes(sampleObj)); > > RiakObject obj = new RiakObject() > > .setContentType("text/plain") > > .setValue(text); > > StoreValue store = new > StoreValue.Builder(obj).withLocation(wildeGeniusQuote) > > .withOption(Option.ASIS, true) > > .withOption(Option.DW, new Quorum(1)) > > .withOption(Option.IF_NONE_MATCH, true) > > .withOption(Option.IF_NOT_MODIFIED, true) > > .withOption(Option.PW, new Quorum(1)) > > .withOption(Option.N_VAL, 1) > > .withOption(Option.RETURN_BODY, true) > > .withOption(Option.RETURN_HEAD, true) > > .withOption(Option.SLOPPY_QUORUM, true) > > .withOption(Option.TIMEOUT, 1000) > > .withOption(Option.W, new Quorum(1)) > > .build(); > > riakClient.execute(store); > > } catch (Exception e) { > > e.printStackTrace(); > > return null; > > } > > Am I still missing something? Thanks. > > > > Caused by: com.basho.riak.client.core.netty.RiakResponseException: > unavailable > > at > com.basho.riak.client.core.netty.RiakResponseHandler.channelRead(RiakResponseHandler.java:52) > > at > io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:340) > > at > io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:326) > > at > io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:155) > > at > io.netty.handler.codec.ByteToMessageCodec.channelRead(ByteToMessageCodec.java:108) > > at > io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:340) > > at > io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:326) > > at > io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:785) > > at > io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:116) > > at > io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:494) > > at > io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:461) > > at > io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:378) > > at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:350) > > at > io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:101) > > ... 1 more > > > _______________________________________________ > riak-users mailing list > [email protected] > http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com > -- Joseph Blomstedt <[email protected]> Principal Engineer Basho Technologies, Inc. http://www.basho.com/ _______________________________________________ riak-users mailing list [email protected] http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
