文档总览:http://www.aerospike.com/docs/
JAVA AeroSpike知识总览:http://www.aerospike.com/docs/client/java/start/index.html
工具总览:http://www.aerospike.com/docs/tools/
1、AeroSpike 下载安装 :
http://www.aerospike.com/docs/operations/install/linux/el6/
依赖:
yum install gcc
yum install autoconf libtool
yum install openssl-devel openssl-static
yum install lua-devel lua-static lua
下载安装:
wget -O aerospike.tgz 'http://aerospike.com/download/server/latest/artifact/el6'
tar -xvf aerospike.tgz
cd aerospike-server-community-*-el6
sudo ./asinstall # will install the .rpm packages
sudo service aerospike start && \
sudo tail -f /var/log/aerospike/aerospike.log | grep cake
# wait for it. "service ready: soon there will be cake!"
安装后的文件:
/etc/aerospike/ - configuration files for Aerospike
/etc/aerospike/aerospike.conf — default configuration for Aerospike
/etc/init.d/aerospike — init script for Aerospike
/etc/logrotate.d/aerospike — logrotate configuration for Aerospike
/opt/aerospike/bin/ — binaries including Aerospike server and tools
/opt/aerospike/doc/ — documents, including licenses
/opt/aerospike/sys/ — system data files, maintained by Aerospike
/opt/aerospike/usr/ — user data files
/var/log/aerospike/ — log files emitted by Aerospike
/usr/bin/asd — Aerospike Server daemon
命令行验证:
cli -h 127.0.0.1 -n test -o set -k Aerospike -b name -v "Aerospike, Inc."
# succeeded: key= Aerospike set= bin= name value= Aerospike, Inc.
cli -h 127.0.0.1 -n test -o set -k Aerospike -b address -v "Mountain View, CA 94043"
# succeeded: key= Aerospike set= bin= address value= Mountain View, CA 94043
cli -h 127.0.0.1 -n test -o set -k Aerospike -b email -v "info@aerospike.com"
# succeeded: key= Aerospike set= bin= email value= info@aerospike.comcli -h 127.0.0.1 -n test -o get -k Aerospike
# {'email': 'info@aerospike.com', 'name': 'Aerospike, Inc.', 'address': 'Mountain View, CA 94043'}
aerospike管理控制台安装:http://www.aerospike.com/docs/amc/
2、Example
http://www.aerospike.com/docs/client/java/examples.html
http://www.aerospike.com/download/client/java/3.1.0/
POM依赖:
<dependency>
<groupId>com.aerospike</groupId>
<artifactId>aerospike-client</artifactId>
<version>3.1.0</version>
</dependency>
代码:
AerospikeClient client = new AerospikeClient("192.168.1.150", 3000);Key key = new Key("test", "demo", "putgetkey");
Bin bin1 = new Bin("bin1", "value1");
Bin bin2 = new Bin("bin2", "value2");// Write a record
client.put(null, key, bin1, bin2);// Read a record
Record record = client.get(null, key);client.close();
3、性能测试
wget https://codeload.github.com/aerospike/aerospike-client-java/zip/master
unzip master
mvn package#使用帮助
#./run_benchmarks -u#load数据:
./run_benchmarks
4