How to install Voldemort on Windows

On 2011年07月20日, in highscalability, by netoearth

分布式 key-value 存储系统

Project Voldemort is a scalable, highly available, NoSql, distributed, key/value store developed by Linkedin which in turn was inspired by Amazon’s Dynamo paper. The source code for Voldemort is currently hosted at GitHub.

Voldemort is written in Java and will run on any platform where Java can run. Getting Voldemort up and running on Linux/OSX or any other Posix based system is seamless. Running Voldemort is a little challenging, but not impossible.

Voldemort Prerequisites

  • Recent Java JDK with Server HotSpot VM
  • Apache Ant
  • Optionally Python 2.6

Download and install the Java SDK and Apache Ant. Make sure the Apache Ant bin directory is on your path.

To verify that you have the Server HotSpot VM installed, open a command window and type the following:

1
java -server -version

You should see something like this:

java version "1.6.0_17"
Java(TM) SE Runtime Environment (build 1.6.0_17-b04)
Java HotSpot(TM) Server VM (build 10.0-b22, mixed mode)
java version "1.6.0_17"Java(TM) SE Runtime Environment (build 1.6.0_17-b04)Java HotSpot(TM) Server VM (build 10.0-b22, mixed mode)

If you get an error about no ‘server’ JVM at c:\Program Files\Java\jreXXX\bin\server.jvm.dll, then you’ll need to monkey-patch your Java installation before continuing.

Java Monkey Patch

  • Locate the directory where your Java JDK was installed (eg C:\Program Files\Java\jdk1.6.0_06)
  • Copy the \jre\bin\server folder to JRE\bin folder (eg: C:\Program Files\Java\jre6\bin)

Verify your Java installation again by entering the following in a command window:

1
java -server -version

You should get output similar to the paragraph above.

Installing Voldemort

For this tutorial, download the latest stable release from the Voldemort repository at GitHub. For this tutorial, I used Release 0.80.1.

After the download is complete, extract the files to a directory of your choosing.

If you navigate to the bin directory, you’ll notice that the majority of script files are shell scripts. Well that’s not going to work on Windows. Time for some more monkey patching.

Shell Script Monkey Patching

For this tutorial I will convert the three scripts you need to get Voldemort up and running:

  • run-class.sh
  • voldemort-server.sh
  • voldermort-shell.sh

Copy or download the 3 files below and place them in your Voldemort \bin directory.

run-class.bat [Download from GitHub]

@echo off
REM
REM Copyright 2008-2009 LinkedIn, Inc
REM Copyright 2010 Erik Howard http://www.gonosql.com http://erikhoward.net
REM
REM Licensed under the Apache License, Version 2.0 (the “License”);
REM you may not use this file except in compliance with the License.
REM You may obtain a copy of the License at
REM
REM http://www.apache.org/licenses/LICENSE-2.0
REM
REM Unless required by applicable law or agreed to in writing, software
REM distributed under the License is distributed on an “AS IS” BASIS,
REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
REM See the License for the specific language governing permissions and
REM limitations under the License.
REM
set Count=0
for %%a in (%*) do set /a Count+=1
if %Count% gtr 1 goto :continue
echo %0 java-class-name [options]
goto :eof
:continue
SET BASE_DIR=%~dp0..
SET CLASSPATH=.
for %%j in (%BASE_DIR%\dist\*.jar) do (call :append_classpath “%%j”)
for %%j in (%BASE_DIR%\lib\*.jar) do (call :append_classpath “%%j”)
goto :run
:append_classpath
set CLASSPATH=%CLASSPATH%;%1
goto :eof
:run
REM You might have to adjust the max allowable memory setting to fit your environment
if “%VOLD_OPTS%” == “” set “VOLD_OPTS=-Xmx256M -server -Dcom.sun.management.jmxremote”
java -Dlog4j.configuration=src/java/log4j.properties %VOLD_OPTS% -cp %CLASSPATH% %*
endlocal
:eof

voldemort-shell.bat [Download from GitHub]

@echo off
REM
REM Copyright 2008-2009 LinkedIn, Inc
REM Copyright 2010 Erik Howard http://www.gonosql.com http://erikhoward.net
REM
REM Licensed under the Apache License, Version 2.0 (the “License”);
REM you may not use this file except in compliance with the License.
REM You may obtain a copy of the License at
REM
REM http://www.apache.org/licenses/LICENSE-2.0
REM
REM Unless required by applicable law or agreed to in writing, software
REM distributed under the License is distributed on an “AS IS” BASIS,
REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
REM See the License for the specific language governing permissions and
REM limitations under the License.
REM
set Count=0
for %%a in (%*) do set /a Count+=1
if %Count% equ 2 goto :continue
echo USAGE: bin/voldemort-shell.bat store_name bootstrap_url [command_file]
goto :eof
:continue
setlocal
SET BASE_DIR=%~dp0..
%BASE_DIR%\bin\run-class.bat jline.ConsoleRunner voldemort.VoldemortClientShell %*
endlocal
:eof

voldemort-server.bat [Download from GitHub]

@echo off
REM
REM Copyright 2008-2009 LinkedIn, Inc
REM Copyright 2010 Erik Howard http://www.gonosql.com http://erikhoward.net
REM
REM Licensed under the Apache License, Version 2.0 (the “License”);
REM you may not use this file except in compliance with the License.
REM You may obtain a copy of the License at
REM
REM http://www.apache.org/licenses/LICENSE-2.0
REM
REM Unless required by applicable law or agreed to in writing, software
REM distributed under the License is distributed on an “AS IS” BASIS,
REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
REM See the License for the specific language governing permissions and
REM limitations under the License.
REM
@echo off
if “%2″ == “” goto :continue
echo USAGE: bin/voldemort-server.bat [voldemort_home]
goto :eof
:continue
setlocal
SET BASE_DIR=%~dp0..
SET CLASSPATH=.
for %%j in (%BASE_DIR%\dist\*.jar) do (call :append_classpath “%%j”)
for %%j in (%BASE_DIR%\lib\*.jar) do (call :append_classpath “%%j”)
goto :run
:append_classpath
set CLASSPATH=%CLASSPATH%;%1
goto :eof
:run
if “%VOLD_OPTS%” == “” set “VOLD_OPTS=-Xmx256M -server -Dcom.sun.management.jmxremote”
REM java -Xmx512M -cp %CLASSPATH% -Dcom.sun.management.jmxremote voldemort.server.VoldemortServer %1
java -Dlog4j.configuration=src/java/log4j.properties %VOLD_OPTS% -cp %CLASSPATH% voldemort.server.VoldemortServer %*
endlocal
:eof

Starting Voldemort

From a command prompt, go to the directory where you extracted Voldemort and type the following:

1
bin\voldemort-server.bat config\single_node_cluster

You should see several lines of information scroll by. Congratulations – you’ve just started Project Voldemort on Windows!

Testing Voldemort

Open up another command window and change to your Voldemort project directory.

Type the following to startup the Voldemort shell:

1
bin\voldemort-shell.bat test tcp://localhost:6666

With the shell up and running, lets try out a few commands

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
put "name" "erik"
get "name"
version(0:1) "erik"
delete "name"
get "name"
null
exit
k k thx bye

Conclusion

Before you can use the full functionality of Voldemort, you must first convert the remaining shell scripts in the bin directory to dos batch scripts. Good Luck.

Comments are closed.