Moved riak_node_comp to riak_node

This commit is contained in:
Jedrzej Nowak 2015-12-07 17:21:10 +01:00
parent 72762979da
commit 729d3b023f
10 changed files with 9 additions and 756 deletions

View File

@ -45,8 +45,9 @@ def setup_riak():
'resources/riak_node',
{'riak_self_name': 'riak%d' % num,
'storage_backend': 'leveldb',
'riak_hostname': 'riak_server%d.solar' % num,
'riak_name': 'riak%d@riak_server%d.solar' % (num, num)})[0]
'riak_hostname': 'riak_server%d.solar' % num})[0]
r.connect(r, {'riak_self_name': 'riak_name',
'riak_hostname': 'riak_name'})
riak_services.append(r)
for i, riak in enumerate(riak_services):

View File

@ -9,22 +9,19 @@ input:
ip:
schema: str!
value:
# ssh_key:
# schema: str!
# value:
# ssh_user:
# schema: str!
# value:
riak_self_name:
schema: str!
value:
riak_hostname:
schema: str!
value:
value:
riak_name:
schema: str!
# value: "{{riak_self_name}}@{{riak_hostname}}"
value: "{{riak_self_name}}@{{ip}}"
value: null
computable:
lang: jinja2
type: full
func: "{{riak_self_name}}@{{riak_hostname}}"
riak_port_http:
schema: int!
value: 18098

View File

@ -1,6 +0,0 @@
- hosts: [{{host}}]
sudo: yes
tasks:
# - shell: sleep 30
- shell: riak-admin cluster plan
- shell: riak-admin cluster commit

View File

@ -1,15 +0,0 @@
- hosts: [{{host}}]
sudo: yes
tasks:
- shell: riak-admin cluster join {{join_to}}
ignore_errors: true
register: join_output
# those below are hacky solution for "this node is already member of a cluster
# solar for now lacks logic that would allow to avoid it
- shell: /bin/true
when: join_output|failed and join_output.stdout.find("This node is already a member of a cluster") != -1
- shell: /bin/false
when: join_output|failed and join_output.stdout.find("This node is already a member of a cluster") == -1
- shell: /bin/true
when: join_output|success

View File

@ -1,6 +0,0 @@
- hosts: [{{host}}]
sudo: yes
tasks:
- apt:
name: riak
state: absent

View File

@ -1,28 +0,0 @@
- hosts: [{{host}}]
sudo: yes
tasks:
# those below are mostly for tests
- shell: killall -u riak
ignore_errors: yes
# remove above when non tests
# we install ubuntu repo there,
# NOT recommended on production
- shell: curl -s https://packagecloud.io/install/repositories/basho/riak/script.deb.sh | sudo bash
- apt:
name: riak
state: present
- service:
name: riak
state: stopped
- file: path=/etc/riak/riak.conf state=touch
- template:
src: {{templates_dir}}/riak.conf
dest: /etc/riak/riak.conf
- shell: rm -fr /var/lib/riak/kv_vnode/*
- shell: rm -fr /var/lib/riak/ring/*
- service:
name: riak
state: reloaded

View File

@ -1,143 +0,0 @@
#!/bin/bash
unknown_os ()
{
echo "Unfortunately, your operating system distribution and version are not supported by this script."
echo "Please email support@packagecloud.io and we will be happy to help."
exit 1
}
curl_check ()
{
echo "Checking for curl..."
if command -v curl > /dev/null; then
echo "Detected curl..."
else
echo "Installing curl..."
apt-get install -q -y curl
fi
}
os=
dist=
host=
get_hostname ()
{
echo "Getting the hostname of this machine..."
host=`hostname -f 2>/dev/null`
if [ "$host" = "" ]; then
host=`hostname 2>/dev/null`
if [ "$host" = "" ]; then
host=$HOSTNAME
fi
fi
if [ "$host" = "" -o "$host" = "(none)" ]; then
echo "Unable to determine the hostname of your system!"
echo
echo "Please consult the documentation for your system. The files you need "
echo "to modify to do this vary between Linux distribution and version."
echo
exit 1
fi
echo "Found hostname: ${host}"
}
# some systems dont have lsb-release yet have the lsb_release binary and
# vice-versa
if [ -e /etc/lsb-release ]; then
. /etc/lsb-release
os=${DISTRIB_ID}
dist=${DISTRIB_CODENAME}
if [ -z "$dist" ]; then
dist=${DISTRIB_RELEASE}
fi
elif [ `which lsb_release 2>/dev/null` ]; then
dist=`lsb_release -c | cut -f2`
os=`lsb_release -i | cut -f2 | awk '{ print tolower($1) }'`
elif [ -e /etc/debian_version ]; then
# some Debians have jessie/sid in their /etc/debian_version
# while others have '6.0.7'
os=`cat /etc/issue | head -1 | awk '{ print tolower($1) }'`
if grep -q '/' /etc/debian_version; then
dist=`cut --delimiter='/' -f1 /etc/debian_version`
else
dist=`cut --delimiter='.' -f1 /etc/debian_version`
fi
else
unknown_os
fi
if [ -z "$dist" ]; then
unknown_os
fi
echo "Detected operating system as $os/$dist."
curl_check
echo -n "Installing apt-transport-https... "
# install apt-https-transport
apt-get install -y apt-transport-https &> /dev/null
echo "done."
get_hostname
apt_source_path="/etc/apt/sources.list.d/basho_riak.list"
apt_config_url="https://packagecloud.io/install/repositories/basho/riak/config_file.list?os=${os}&dist=${dist}&name=${host}&source=script"
echo -n "Installing $apt_source_path..."
# create an apt config file for this repository
curl -f "${apt_config_url}" > $apt_source_path
curl_exit_code=$?
if [ "$curl_exit_code" = "22" ]; then
echo -n "Unable to download repo config from: "
echo "${apt_config_url}"
echo
echo "Please contact support@packagecloud.io and report this."
[ -e $apt_source_path ] && rm $apt_source_path
exit 1
elif [ "$curl_exit_code" = "35" ]; then
echo "curl is unable to connect to packagecloud.io over TLS when running: "
echo " curl ${apt_config_url}"
echo "This is usually due to one of two things:"
echo
echo " 1.) Missing CA root certificates (make sure the ca-certificates package is installed)"
echo " 2.) An old version of libssl. Try upgrading libssl on your system to a more recent version"
echo
echo "Contact support@packagecloud.io with information about your system for help."
[ -e $apt_source_path ] && rm $apt_source_path
exit 1
elif [ "$curl_exit_code" -gt "0" ]; then
echo
echo "Unable to run: "
echo " curl ${apt_config_url}"
echo
echo "Double check your curl installation and try again."
[ -e $apt_source_path ] && rm $apt_source_path
exit 1
else
echo "done."
fi
echo -n "Importing packagecloud gpg key... "
# import the gpg key
curl https://packagecloud.io/gpg.key 2> /dev/null | apt-key add - &>/dev/null
echo "done."
echo -n "Running apt-get update... "
# update apt on this system
apt-get update &> /dev/null
echo "done."

View File

@ -1,12 +0,0 @@
- hosts: [{{host}}]
sudo: yes
tasks:
- service:
name: riak
state: stopped
- template:
src: {{templates_dir}}/riak.conf
dest: /etc/riak/riak.conf
- service:
name: riak
state: reloaded

View File

@ -1,41 +0,0 @@
id: riak_node
handler: ansible
version: 1.0.0
actions:
commit: commit.yaml
run: run.yaml
join: join.yaml
input:
ip:
schema: str!
value:
riak_self_name:
schema: str!
value:
riak_hostname:
schema: str!
value:
riak_name:
schema: str!
value: null
computable:
lang: lua
type: full
func: |
local l = make_arr(data)
return l[resource_name]["riak_self_name"] .. "@" .. l[resource_name]["riak_hostname"]
riak_port_http:
schema: int!
value: 18098
riak_port_pb:
schema: int!
value: 18087
riak_port_solr:
schema: int!
value: 8985
join_to:
schema: str
value:
storage_backend:
schema: str!
value: bitcask

View File

@ -1,494 +0,0 @@
## Where to emit the default log messages (typically at 'info'
## severity):
## off: disabled
## file: the file specified by log.console.file
## console: to standard output (seen when using `riak attach-direct`)
## both: log.console.file and standard out.
##
## Default: file
##
## Acceptable values:
## - one of: off, file, console, both
log.console = file
## The severity level of the console log, default is 'info'.
##
## Default: info
##
## Acceptable values:
## - one of: debug, info, notice, warning, error, critical, alert, emergency, none
log.console.level = info
## When 'log.console' is set to 'file' or 'both', the file where
## console messages will be logged.
##
## Default: $(platform_log_dir)/console.log
##
## Acceptable values:
## - the path to a file
log.console.file = $(platform_log_dir)/console.log
## The file where error messages will be logged.
##
## Default: $(platform_log_dir)/error.log
##
## Acceptable values:
## - the path to a file
log.error.file = $(platform_log_dir)/error.log
## When set to 'on', enables log output to syslog.
##
## Default: off
##
## Acceptable values:
## - on or off
log.syslog = off
## Whether to enable the crash log.
##
## Default: on
##
## Acceptable values:
## - on or off
log.crash = on
## If the crash log is enabled, the file where its messages will
## be written.
##
## Default: $(platform_log_dir)/crash.log
##
## Acceptable values:
## - the path to a file
log.crash.file = $(platform_log_dir)/crash.log
## Maximum size in bytes of individual messages in the crash log
##
## Default: 64KB
##
## Acceptable values:
## - a byte size with units, e.g. 10GB
log.crash.maximum_message_size = 64KB
## Maximum size of the crash log in bytes, before it is rotated
##
## Default: 10MB
##
## Acceptable values:
## - a byte size with units, e.g. 10GB
log.crash.size = 10MB
## The schedule on which to rotate the crash log. For more
## information see:
## https://github.com/basho/lager/blob/master/README.md#internal-log-rotation
##
## Default: $D0
##
## Acceptable values:
## - text
log.crash.rotation = $D0
## The number of rotated crash logs to keep. When set to
## 'current', only the current open log file is kept.
##
## Default: 5
##
## Acceptable values:
## - an integer
## - the text "current"
log.crash.rotation.keep = 5
## Name of the Erlang node
##
## Default: riak@127.0.0.1
##
## Acceptable values:
## - text
nodename = {{riak_name}}
## Cookie for distributed node communication. All nodes in the
## same cluster should use the same cookie or they will not be able to
## communicate.
##
## Default: riak
##
## Acceptable values:
## - text
distributed_cookie = riak
## Sets the number of threads in async thread pool, valid range
## is 0-1024. If thread support is available, the default is 64.
## More information at: http://erlang.org/doc/man/erl.html
##
## Default: 64
##
## Acceptable values:
## - an integer
erlang.async_threads = 64
## The number of concurrent ports/sockets
## Valid range is 1024-134217727
##
## Default: 65536
##
## Acceptable values:
## - an integer
erlang.max_ports = 65536
## Set scheduler forced wakeup interval. All run queues will be
## scanned each Interval milliseconds. While there are sleeping
## schedulers in the system, one scheduler will be woken for each
## non-empty run queue found. An Interval of zero disables this
## feature, which also is the default.
## This feature is a workaround for lengthy executing native code, and
## native code that do not bump reductions properly.
## More information: http://www.erlang.org/doc/man/erl.html#+sfwi
##
## Default: 500
##
## Acceptable values:
## - an integer
## erlang.schedulers.force_wakeup_interval = 500
## Enable or disable scheduler compaction of load. By default
## scheduler compaction of load is enabled. When enabled, load
## balancing will strive for a load distribution which causes as many
## scheduler threads as possible to be fully loaded (i.e., not run out
## of work). This is accomplished by migrating load (e.g. runnable
## processes) into a smaller set of schedulers when schedulers
## frequently run out of work. When disabled, the frequency with which
## schedulers run out of work will not be taken into account by the
## load balancing logic.
## More information: http://www.erlang.org/doc/man/erl.html#+scl
##
## Default: false
##
## Acceptable values:
## - one of: true, false
## erlang.schedulers.compaction_of_load = false
## Enable or disable scheduler utilization balancing of load. By
## default scheduler utilization balancing is disabled and instead
## scheduler compaction of load is enabled which will strive for a
## load distribution which causes as many scheduler threads as
## possible to be fully loaded (i.e., not run out of work). When
## scheduler utilization balancing is enabled the system will instead
## try to balance scheduler utilization between schedulers. That is,
## strive for equal scheduler utilization on all schedulers.
## More information: http://www.erlang.org/doc/man/erl.html#+sub
##
## Acceptable values:
## - one of: true, false
## erlang.schedulers.utilization_balancing = true
## Number of partitions in the cluster (only valid when first
## creating the cluster). Must be a power of 2, minimum 8 and maximum
## 1024.
##
## Default: 64
##
## Acceptable values:
## - an integer
ring_size = 8
## Number of concurrent node-to-node transfers allowed.
##
## Default: 2
##
## Acceptable values:
## - an integer
## transfer_limit = 2
## Default cert location for https can be overridden
## with the ssl config variable, for example:
##
## Acceptable values:
## - the path to a file
## ssl.certfile = $(platform_etc_dir)/cert.pem
## Default key location for https can be overridden with the ssl
## config variable, for example:
##
## Acceptable values:
## - the path to a file
## ssl.keyfile = $(platform_etc_dir)/key.pem
## Default signing authority location for https can be overridden
## with the ssl config variable, for example:
##
## Acceptable values:
## - the path to a file
## ssl.cacertfile = $(platform_etc_dir)/cacertfile.pem
## DTrace support Do not enable 'dtrace' unless your Erlang/OTP
## runtime is compiled to support DTrace. DTrace is available in
## R15B01 (supported by the Erlang/OTP official source package) and in
## R14B04 via a custom source repository & branch.
##
## Default: off
##
## Acceptable values:
## - on or off
dtrace = off
## Platform-specific installation paths (substituted by rebar)
##
## Default: ./bin
##
## Acceptable values:
## - the path to a directory
platform_bin_dir = ./bin
##
## Default: ./data
##
## Acceptable values:
## - the path to a directory
platform_data_dir = ./data
##
## Default: ./etc
##
## Acceptable values:
## - the path to a directory
platform_etc_dir = ./etc
##
## Default: ./lib
##
## Acceptable values:
## - the path to a directory
platform_lib_dir = ./lib
##
## Default: ./log
##
## Acceptable values:
## - the path to a directory
platform_log_dir = ./log
## Enable consensus subsystem. Set to 'on' to enable the
## consensus subsystem used for strongly consistent Riak operations.
##
## Default: off
##
## Acceptable values:
## - on or off
## strong_consistency = on
## listener.http.<name> is an IP address and TCP port that the Riak
## HTTP interface will bind.
##
## Default: 127.0.0.1:8098
##
## Acceptable values:
## - an IP/port pair, e.g. 127.0.0.1:10011
listener.http.internal = 0.0.0.0:{{riak_port_http}}
## listener.protobuf.<name> is an IP address and TCP port that the Riak
## Protocol Buffers interface will bind.
##
## Default: 127.0.0.1:8087
##
## Acceptable values:
## - an IP/port pair, e.g. 127.0.0.1:10011
listener.protobuf.internal = 0.0.0.0:{{riak_port_pb}}
## The maximum length to which the queue of pending connections
## may grow. If set, it must be an integer > 0. If you anticipate a
## huge number of connections being initialized *simultaneously*, set
## this number higher.
##
## Default: 128
##
## Acceptable values:
## - an integer
## protobuf.backlog = 128
## listener.https.<name> is an IP address and TCP port that the Riak
## HTTPS interface will bind.
##
## Acceptable values:
## - an IP/port pair, e.g. 127.0.0.1:10011
## listener.https.internal = 127.0.0.1:8098
## How Riak will repair out-of-sync keys. Some features require
## this to be set to 'active', including search.
## * active: out-of-sync keys will be repaired in the background
## * passive: out-of-sync keys are only repaired on read
## * active-debug: like active, but outputs verbose debugging
## information
##
## Default: active
##
## Acceptable values:
## - one of: active, passive, active-debug
anti_entropy = active
## Specifies the storage engine used for Riak's key-value data
## and secondary indexes (if supported).
##
## Default: bitcask
##
## Acceptable values:
## - one of: bitcask, leveldb, memory, multi
storage_backend = {{storage_backend}}
## Controls which binary representation of a riak value is stored
## on disk.
## * 0: Original erlang:term_to_binary format. Higher space overhead.
## * 1: New format for more compact storage of small values.
##
## Default: 1
##
## Acceptable values:
## - the integer 1
## - the integer 0
object.format = 1
## Reading or writing objects bigger than this size will write a
## warning in the logs.
##
## Default: 5MB
##
## Acceptable values:
## - a byte size with units, e.g. 10GB
object.size.warning_threshold = 5MB
## Writing an object bigger than this will send a failure to the
## client.
##
## Default: 50MB
##
## Acceptable values:
## - a byte size with units, e.g. 10GB
object.size.maximum = 50MB
## Writing an object with more than this number of siblings will
## generate a warning in the logs.
##
## Default: 25
##
## Acceptable values:
## - an integer
object.siblings.warning_threshold = 25
## Writing an object with more than this number of siblings will
## send a failure to the client.
##
## Default: 100
##
## Acceptable values:
## - an integer
object.siblings.maximum = 100
## A path under which bitcask data files will be stored.
##
## Default: $(platform_data_dir)/bitcask
##
## Acceptable values:
## - the path to a directory
bitcask.data_root = $(platform_data_dir)/bitcask
## Configure how Bitcask writes data to disk.
## erlang: Erlang's built-in file API
## nif: Direct calls to the POSIX C API
## The NIF mode provides higher throughput for certain
## workloads, but has the potential to negatively impact
## the Erlang VM, leading to higher worst-case latencies
## and possible throughput collapse.
##
## Default: erlang
##
## Acceptable values:
## - one of: erlang, nif
bitcask.io_mode = erlang
## Set to 'off' to disable the admin panel.
##
## Default: off
##
## Acceptable values:
## - on or off
riak_control = on
## Authentication mode used for access to the admin panel.
##
## Default: off
##
## Acceptable values:
## - one of: off, userlist
riak_control.auth.mode = off
## If riak control's authentication mode (riak_control.auth.mode)
## is set to 'userlist' then this is the list of usernames and
## passwords for access to the admin panel.
## To create users with given names, add entries of the format:
## riak_control.auth.user.USERNAME.password = PASSWORD
## replacing USERNAME with the desired username and PASSWORD with the
## desired password for that user.
##
## Acceptable values:
## - text
## riak_control.auth.user.admin.password = pass
## This parameter defines the percentage of total server memory
## to assign to LevelDB. LevelDB will dynamically adjust its internal
## cache sizes to stay within this size. The memory size can
## alternately be assigned as a byte count via leveldb.maximum_memory
## instead.
##
## Default: 70
##
## Acceptable values:
## - an integer
leveldb.maximum_memory.percent = 70
## To enable Search set this 'on'.
##
## Default: off
##
## Acceptable values:
## - on or off
search = off
## How long Riak will wait for Solr to start. The start sequence
## will be tried twice. If both attempts timeout, then the Riak node
## will be shutdown. This may need to be increased as more data is
## indexed and Solr takes longer to start. Values lower than 1s will
## be rounded up to the minimum 1s.
##
## Default: 30s
##
## Acceptable values:
## - a time duration with units, e.g. '10s' for 10 seconds
search.solr.start_timeout = 30s
## The port number which Solr binds to.
## NOTE: Binds on every interface.
##
## Default: 8093
##
## Acceptable values:
## - an integer
search.solr.port = 8093
## The port number which Solr JMX binds to.
## NOTE: Binds on every interface.
##
## Default: 8985
##
## Acceptable values:
## - an integer
search.solr.jmx_port = 8985
## The options to pass to the Solr JVM. Non-standard options,
## i.e. -XX, may not be portable across JVM implementations.
## E.g. -XX:+UseCompressedStrings
##
## Default: -d64 -Xms1g -Xmx1g -XX:+UseStringCache -XX:+UseCompressedOops
##
## Acceptable values:
## - text
search.solr.jvm_options = -d64 -Xms1g -Xmx1g -XX:+UseStringCache -XX:+UseCompressedOops
# new