Skip to content

Instantly share code, notes, and snippets.

@alexmoore
Last active November 18, 2021 09:39
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save alexmoore/7bbdece19223cea1e144e4d23a5ed7ec to your computer and use it in GitHub Desktop.
Save alexmoore/7bbdece19223cea1e144e4d23a5ed7ec to your computer and use it in GitHub Desktop.
Building Basho Erlang / Riak TS on a Raspberry Pi 3
This is unsupported by Basho, but you can build Basho's flavor of Erlang and Riak on Raspberry Pis.
sudo apt-get install build-essential git autoconf libncurses5-dev openssl libssl-dev fop xsltproc unixodbc-dev libpam0g-dev oracle-java8-jdk maven
mkdir src
cd src
wget http://s3.amazonaws.com/downloads.basho.com/erlang/otp_src_R16B02-basho10.tar.gz
tar zxvf otp_src_R16B02-basho10.tar.gz
cd OTP_R16B02_basho10/
# Note: These steps will take a long time.
./otp_build autoconf
./configure
make
sudo make install
# Report version & arch
erl -eval 'erlang:display(erlang:system_info(otp_release)), erlang:display(erlang:system_info(system_architecture)), halt().' -noshell
# cd back to src dir
cd ../;
# In src dir
git clone https://github.com/basho/riak.git
cd riak
# Run this to build Riak TS 1.5.0
git checkout riak_ts-1.5.0
# Run this to build Riak KV 2.2.1
git checkout riak-2.2.0
make locked-deps
cd deps/eleveldb/c_src/leveldb;
git checkout develop;
cd ../
# If not using a cluster of pis, edit number of leveldb threads to save memory
#sed -i '221s/71/7/g' eleveldb.cc
cd ../../../;
make rel;
cd rel/riak/
echo "leveldb.limited_developer_mem = on" >> etc/riak.conf
## Edit the nodename and ip bindings in the etc/riak.conf file too, riak@raspberrypi may not work
bin/riak start;
@fadushin
Copy link

Thanks for the notes, Alex.

On Raspian jessie, I made the following changes to eleveldb and leveldb, but using the versions of eleveldb and leveldb associated with Riak version 2.2.3 (i.e., not develop, as listed above):

diff --git a/c_src/eleveldb.cc b/c_src/eleveldb.cc
index 94e0e4f..9a7cc4b 100644
--- a/c_src/eleveldb.cc
+++ b/c_src/eleveldb.cc
@@ -193,7 +193,7 @@ struct EleveldbOptions
     bool m_FadviseWillNeed;
 
     EleveldbOptions()
-        : m_EleveldbThreads(71),
+        : m_EleveldbThreads(7),
           m_LeveldbImmThreads(0), m_LeveldbBGWriteThreads(0),
           m_LeveldbOverlapThreads(0), m_LeveldbGroomingThreads(0),
           m_TotalMemPercent(0), m_TotalMem(0),

and

diff --git a/util/perf_count.cc b/util/perf_count.cc
index ac6aaa2..e992ce3 100644
--- a/util/perf_count.cc
+++ b/util/perf_count.cc
@@ -360,11 +360,11 @@ PerformanceCounters * gPerfCounters(&LocalStartupCounters);
             uint32_t ret_32, * ptr_32;
 
             ptr_32=(uint32_t *)&val_ptr;
-            ret_32=inc_and_fetch(ptr_32, 1);
+            ret_32=inc_and_fetch(ptr_32);
             if (0==ret_32)
             {
                 ++ptr_32;
-                inc_and_fetch(ptr_32, 1);
+                inc_and_fetch(ptr_32);
             }   // if
 #endif
             ret_val=*val_ptr;
@@ -432,11 +432,11 @@ PerformanceCounters * gPerfCounters(&LocalStartupCounters);
 
             ptr_32=(uint32_t *)&val_ptr;
             old_32=*ptr_32;
-            ret_32=add_and_fetch(ptr_32, Amount);
+            ret_32=add_and_fetch(ptr_32, static_cast<uint32_t>(Amount));
             if (ret_32<old_32)
             {
                 ++ptr_32;
-                add_and_fetch(ptr_32, 1);
+                add_and_fetch(ptr_32, static_cast<uint32_t>(1));
             }   // if
 
             ret_val=*val_ptr;

Also may want to mention --prefix option to configure, in case you already have an OTP installed via apt-get, but I am sure many folks already know that.

@fadushin
Copy link

Believe it or not Solr does actually run, though it's pretty slow. You'll also need the following config in your riak.conf to turn off some of the flags expected on 64 bit machines, and to give yz_solr_proc enough time for Solr to start without crapping out. (30s is the default):

search = on
search.solr.jvm_options = -XX:+UseStringCache
search.solr.start_timeout=5m

Copy link

ghost commented Jan 15, 2018

Hi,

Can you tell me what version of Raspbian this is starting from? Stretch or Jessie?

Is it from a completely fresh install?

Cheers

Gareth

@Ei3rb0mb3r
Copy link

If I follow the steps from above I get the following error message:
make locked-deps...
ERROR:
Cloning into fuse...
Host key verification failed
fatal:Could not read from remote respository

I have little experience and don't know what to do.

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment