Skip to content

Instantly share code, notes, and snippets.

@stefan-mees
Last active January 1, 2016 04:42
Show Gist options
  • Save stefan-mees/8042413 to your computer and use it in GitHub Desktop.
Save stefan-mees/8042413 to your computer and use it in GitHub Desktop.
riak ops cheatsheet
%% get config at runtime
rpc:call(node(), application, get_all_env, [bitcask]).
%% set config at runtime for a node
rpc:call(node(), application, set_env, [bitcask, merge_window, always]).
%% get config for all nodes in a cluster
rpc:multicall(application, get_all_env, [bitcask]).
%% set config for all nodes in a cluster
rpc:multicall(application, set_env, [bitcask, merge_window, always]).
%% workaround for scheduler going to sleep too aggressively (increasing response times, decreased cpu utilization)
erlang:system_flag(schedulers_online, 1).
erlang:system_flag(schedulers_online, 8). %% value from erlang:system_info(schedulers_online)
export CPU_COUNT=`cat /proc/cpuinfo | grep -ce '^processor[[:space:]]:'`
/usr/lib/riak/erts-5.9.1/bin/to_erl /tmp/riak/ <<EOF
erlang:system_flag(schedulers_online, 1).
timer:sleep(200).
erlang:system_flag(schedulers_online, $CPU_COUNT).
erlang:system_info(schedulers_online).
EOF
sudo riak-admin vnode-status | grep key_count | awk 'match($0, /[0-9]+/) { x += substr($0, RSTART, RLENGTH) } END {print x}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment