[关闭]
@1234567890 2018-03-23T13:05:35.000000Z 字数 1873 阅读 1493

Aerospike 安装

Aerospike


  1. //server
  2. wget http://www.aerospike.com/artifacts/aerospike-server-community/3.6.2/aerospike-server-community-3.6.2.tar.gz
  3. //tools
  4. wget -O aerospike-tools.tgz 'http://www.aerospike.com/artifacts/aerospike-server-community/3.6.2/aerospike-server-community-3.6.2-el6.tgz'
  5. //AMC 控制台
  6. wget https://www.aerospike.com/artifacts/aerospike-amc-community/3.6.2/aerospike-amc-community-3.6.2.tar.gz

环境准备

  1. yum install gcc
  2. yum install autoconf libtool
  3. yum install openssl-devel openssl-static
  4. yum install lua-devel lua-static lua

安装server

  1. tar -zxvf aerospike-server-community-3.6.2.tar.gz && cd aerospike-server
  2. bin/aerospike init
  3. tar -zxvf aerospike-tools.tgz
  4. cd aerospike-server-community-3.6.2-el6/
  5. rpm -Uvh aerospike-tools-3.6.2.2-1.el6.x86_64.rpm

安装AMC管理台

  1. tar -xvf aerospike-amc-community-3.6.2.tar.gz && cd aerospike-amc-community-3.6.2
  2. ./install

启动命令

  1. #AeroSpike服务启动
  2. bin/aerospike start
  3. #AeroSpike服务重启
  4. bin/aerospike restart
  5. #AeroSpike服务停止
  6. bin/aerospike stop
  7. #启动amc
  8. /etc/init.d/amc start
  9. #停止amc
  10. /etc/init.d/amc stop
  11. #重启amc
  12. /etc/init.d/amc restart
  13. #查看amc状态
  14. /etc/init.d/amc status
  15. #查看amc启动报错日志
  16. /var/log/amc/error.log
  17. #查看server日志
  18. /var/log/aerospike/aerospike.log

管理后台访问链接

  1. http://host:8081

项目maven依赖

  1. <dependencies>
  2. <dependency>
  3. <groupId>com.aerospike</groupId>
  4. <artifactId>aerospike-client</artifactId>
  5. <version>3.6.2</version>
  6. </dependency>
  7. </dependencies>

集群问题

image_1c990v2ck1igk1g3816llsp2dcq9.png-9.2kB

其中multicast表示在同一网段中广播,所有使用相同address和port的Aerospike会自动组合成集群。但在Aerospike集群中,如果namespace名称相同,配置不同则会报错。解决方法可以把IP地址换成其他的,如139.1.99.222。

命令

asmonitor

在Monitor下查看Aerospike集群信息,如节点个数、内存使用情况等:
info

asadm

在asadm下查看集群节点情况
i net

aql

进入aql命令模式下就可以使用如图SQL语句中DDL和DML语句进行创建命名空间。这里的命名空间相当于数据库中的表。

  1. show namespaces;
  2. select * from test
  3. insert into test(pk,id,name,age) values('key1','101','AAA','21');
  4. delete from test where pk='key2'

备份还原

  1. //备份
  2. -d为导出需要保存的文件
  3. -n为需要导出的namespace
  4. 高优先级 -f 3,
  5. 如果集群失败了(即你希望数据是正确的),终止备份 -c
  6. 提供详细的信息到控制台-v
  7. asbackup -h 10.0.0.9 -p 3000 -d backup_01_23_2013 -n test -f3 -c -v
  8. //还原
  9. asrestore -h 127.0.0.1 -p 3000 -d /home/aerospike/backup_10_23_2011
添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注