Riak

From GeilThings

Jump to: navigation, search
Riak
General
Version 1.2.1
Stable 1.3.0
Function Database
Written in Erlang
SQL NoSQL
Port 8098
Files
Config File /opt/riak/rel/riak/etc/app.config

/opt/riak/rel/riak/etc/vm.args

Log File /opt/riak/rel/riak/log/*
Scripts
Version Script The given value was not understood.
Start /opt/riak/rel/riak/bin/riak start
Stop /opt/riak/rel/riak/bin/riak stop


Contents

General

Check if there is a new version

cd /opt
rm -f RELEASE-NOTES.md
wget https://github.com/basho/riak/blob/master/RELEASE-NOTES.md
NEWVERSION=`grep -m 1 "Release Notes" "RELEASE-NOTES.md" | grep -Po '^.*?\K(?<=Riak ).*?(?= Release)';`
echo $NEWVERSION

Installing Riak

yum install gcc gcc-c++ glibc-devel make
 
RAWNEWVERSION=`curl -d "action=ask&query=[[Riak]]|%3FStable&format=json" http://www.geilthings.com/api.php` 
NEWVERSION=`echo "$RAWNEWVERSION" | grep -Po '^.*?\K(?<=Stable\":\[\").*?(?=\")'`  
echo $NEWVERSION
 
cd /opt
wget http://downloads.basho.com/riak/CURRENT/riak-${NEWVERSION}.tar.gz
tar zxvf riak-${NEWVERSION}.tar.gz
cd riak-${NEWVERSION}
make rel
 
cd /opt
ln -s riak-${NEWVERSION} /opt/riak
 
# Add /opt/riak/rel/riak/bin to the PATH variable in /etc/profile.
PATH=$PATH:/opt/riak/rel/riak/bin 
export PATH
# Reload /etc/profile.
. /etc/profile
 
# Check.
/opt/riak/rel/riak/bin/riak start
ps aux | grep riak
# ...
/opt/riak/rel/riak/bin/riak ping
# Great! Answer: pong
/opt/riak/rel/riak/bin/riak-admin test
# Answer: Successfully completed 1 read/write cycle to 'riak@127.0.0.1'
curl -v http://127.0.0.1:8098/riak/test
# Answer: See http://wiki.basho.com/Installation.html

Updating Riak

See official documentation: http://wiki.basho.com/Rolling-Upgrades.html

######### START EDIT #########
 
APPNAME=riak
# The directory where I want to download the .zip files from the MediaWiki site.
DOWNLOADDIRECTORY=/opt
# Set it to TRUE to backup the application.
ISBACKUP=TRUE
# BACKUPROOTDIR is only relevant if ISBACKUP=TRUE
BACKUPROOTDIR=/home/backup
DATE=`date +%Y-%m-%d`
 
######### END OF EDIT #########
 
# Riak must be running to read the version number.
OLDVERSION=`riak-admin status | grep riak_kv_version | grep -Po '^.*?\K(?<=\").*?(?=\")'`
echo $OLDVERSION
 
RAWNEWVERSION=`curl -sd "action=ask&query=[[Riak]]|%3FStable&format=json" http://www.geilthings.com/api.php` 
NEWVERSION=`echo "$RAWNEWVERSION" | grep -Po '^.*?\K(?<=Stable\":\[\").*?(?=\")'`  
echo $NEWVERSION
 
if [[ ${ISBACKUP} == "TRUE" ]]; then
  # The script breaks if variable names are not enclosed with {}
  BACKUPDIR=${BACKUPROOTDIR}/${APPNAME}/${APPNAME}_${OLDVERSION}_${DATE}
  echo $BACKUPDIR
  # Create backup directory if it does not exist.
  if [ ! -d "${BACKUPDIR}" ]; then
    mkdir -m 755 -p ${BACKUPDIR}
  fi
  # Backup data and configuration files.
  # Data: Is that all??? +++ TODO +++
  cp -r /opt/riak/rel/riak/data ${BACKUPDIR}
  cp -r /opt/riak/rel/riak/etc ${BACKUPDIR}
fi
 
riak stop
# As of Riak 1.1.2, 1.2.1, the stop script will NOT kill one of the processes started by the start script, 
# the epmd daemon (/opt/riak/rel/riak/erts-5.9.1/bin/epmd -daemon). 
# epmd: Erlang Port Mapper Daemon (http://erlang.org/doc/man/epmd.html). 
# Kill it with /opt/riak/rel/riak/erts-5.9.2/bin/epmd -kill
/opt/riak/rel/riak/erts-5.9.2/bin/epmd -kill
 
cd ${DOWNLOADDIRECTORY}
# NEWVERSION is in the form 1.1.4-1
# wget http://downloads.basho.com/riak/CURRENT/riak-${NEWVERSION}.tar.gz
wget http://s3.amazonaws.com/downloads.basho.com/riak/CURRENT/riak-${NEWVERSION}.tar.gz
tar zxvf riak-${NEWVERSION}.tar.gz
cd riak-${NEWVERSION}
make rel
 
cd ${DOWNLOADDIRECTORY}
rm -f ${DOWNLOADDIRECTORY}t/riak
ln -s riak-${NEWVERSION} ${DOWNLOADDIRECTORY}/riak
 
# Check.
riak start
ps aux | grep ${APPNAME}
# ...
VERSION=`riak-admin status | grep riak_kv_version | grep -Po '^.*?\K(?<=\").*?(?=\")'`
echo $VERSION
 
riak ping
# Answer: pong
riak-admin test
# Answer: Successfully completed 1 read/write cycle to 'riak@127.0.0.1'
curl -v http://127.0.0.1:8098/riak/test
# Answer: See http://wiki.basho.com/Installation.html
 
mv ${DOWNLOADDIRECTORY}/riak-${OLDVERSION} ${DOWNLOADDIRECTORY}/old_riak-${OLDVERSION}

Issues

Error after make rel, Erlang R16B, Riak 1.3.0

ERROR: OTP release R16B does not match required regex R14B0[234]|R15

make: *** [compile] Error 1

Solution: None found. In riak/rebar.config, substitute {require_otp_vsn, "R14B0[234]|R15"}. with {require_otp_vsn, "R14B0[234]|R15|R16"}.. However, other errors appear later:

src/mochifmt_records.erl:12: parameterized modules are no longer supported

src/mochifmt_records.erl:19: variable 'Recs' is unbound

Error after make rel, Erlang R15B01

  • Riak 1.1.2, Riak 1.1.4: Erlang R15B01: Error after "make rel": ERROR: OTP release R15B01 does not match required regex R13B04|R14
    • Solution: See https://github.com/basho/riak/issues/131
    • In riak/rebar.config, substitute {require_otp_vsn, "R14B0[234]"}. with {require_otp_vsn, "R14B0[234]|R15"}.
    • In riak/deps/cluster_info/rebar.config, riak/deps/riak_kv/rebar.config, riak/deps/riak_search/rebar.config, substitute {require_otp_vsn, "R13B04|R14"}. with {require_otp_vsn, "R13B04|R14|R15"}.

Comments

blog comments powered by Disqus