Skip to content

Instantly share code, notes, and snippets.

View angrycub's full-sized avatar

Charlie Voiselle angrycub

View GitHub Profile
@angrycub
angrycub / delete_mode.md
Created February 8, 2013 18:49
Mailing List Post from Jon Meredith about Delete Mode.

Summary/tl;dr - Riak 1.0.0 has introduced more control over deletion with the delete_mode setting.

If you plan to delete and recreate objects under the same key rapidly, and there is enough disk available to store tombstones, it is safest to set delete_mode to keep.

The default three second delay for removing tombstones balances keeping the tombstone around long enough for any rapid delete/recreates, but unlike the keep mode it does remove the data.

Riak keeps your objects available during failures by storing multiple copies of the data. This redundancy makes deletion more complex than a single node database. For example, Riak needs to ensure deletes issued while nodes are down get applied when the nodes recover, or resolve what happens if the network is partitioned and an object is deleted on one side but updated on the other side.

Deletes in Riak are a two step process, first it writes a tombstone objects to the N replicas and only once all replicas have stored the tombstone are they remove

@angrycub
angrycub / readme.md
Last active December 12, 2015 07:18
Simple Riak Replication Hook Sample

To install the sample hook,

  • Compile riak_repl_hook_sample.erl

    Note on the Erlang Compiler: You must use the Erlang compiler (erlc) associated with the Riak installation or the version of Erlang used when compiling Riak from source. For packaged Riak installations, you can consult Table 1 below for the default location of Riak’s erlc for each supported platform. If you compiled from source, use the erlc from the Erlang version you used to compile Riak.

    Distribution Path
    CentOS & RHEL Linux /usr/lib64/riak/erts-5.9.1/bin/erlc
    Debian & Ubuntu Linux /usr/lib/riak/erts-5.9.1/bin/erlc
@angrycub
angrycub / process.md
Last active October 17, 2017 10:03
Using Force Remove to Change a nodes IP address.

##Using Force Replace to Change a nodes IP address. ###Objective Previous to Riak 1.2, a cluster node's IP address could be changed by running riak-admin reip on each cluster node. As of Riak 1.2, this method has been replaced with riak-admin cluster force-replace which is safer and does not require any downtime.

###Scenario

Riak is running in a cluster of five nodes.

@angrycub
angrycub / gist:4447147
Created January 3, 2013 20:53
Unstick Schedulers
Scheds = erlang:system_flag(schedulers_online, 1),
timer:sleep(250),
_ = erlang:system_flag(schedulers_online, Scheds),
erlang:system_info(schedulers_online).
@angrycub
angrycub / GameLeaderboard.java
Created November 29, 2012 22:36
Resolver Informing Transient Object Variable
package basho;
import com.basho.riak.client.convert.RiakKey;
import java.util.ArrayList;
import java.util.Collection;
import java.util.TreeSet;
import org.codehaus.jackson.annotate.JsonIgnore;
public final class GameLeaderboard
{
@angrycub
angrycub / LegacyRiakReplInstallation.md
Created November 14, 2012 19:12
Beginning of Replication Setup Documentation

Riak MDC Quick Start

The Riak MDC Quick Start will walk through the process of configuring Riak MDC replication to perform bidirectional replication between two exemplar Riak clusters in separate networks. Bidirectional replication is accomplished by setting up unidirectional replication in both directions between the clusters.

###Scenario Configure Riak MDC to perform bidirectional replication, given the following two (2) three-node Riak EE Clusters:

####Cluster 1

[email protected]
nameipnodename
@angrycub
angrycub / process.md
Created November 8, 2012 22:06
Replacing a Node to End with a Node of the Same Name

##Replacing a node with a machine of the same name ###Objective The goal is to replace a Riak instance with a new Riak instance of the same name so that the application environment does not need to have instance-name related changes.

###Scenario

Riak is running in a cluster of five nodes.

@angrycub
angrycub / gist:3934789
Created October 22, 2012 21:56
Examples of Conditional PUTS using the riak-java-client.
import com.basho.riak.client.IRiakClient;
import com.basho.riak.client.IRiakObject;
import com.basho.riak.client.RiakFactory;
import com.basho.riak.client.bucket.Bucket;
import com.basho.riak.client.builders.RiakObjectBuilder;
public class RiakSandbox {
public static final String BUCKET_NAME = "conditionalPutTest";