[完结]docker-compose部署aerospike(单机)

获取镜像文件

sudo docker pull aerospike/aerospike-server:5.7.0.8
sudo docker pull aerospike/aerospike-tools:5.7.0.8

创建环境目录

mkdir -p ./data/aerospike-server/{conf,data}

编写启动文件,首次执行获取配置文件脚本

version: '3'
services:
  aerospike-server:
    image: aerospike/aerospike-server:5.7.0.8
    container_name: aerospike-server
    restart: always
    environment:
      - TZ="Asia/Shanghai"
    ports:
      - 3000:3000
      - 3001:3001
      - 3002:3002
      - 3003:3003

拷贝配置文件放入conf目录

docker cp aerospike-server:/etc/aerospike/aerospike.conf

重新编写docker-compose文件

version: '3'
services:
  aerospike-server:
    image: aerospike/aerospike-server:5.7.0.8
    container_name: aerospike-server
    restart: always
    environment:
      - TZ="Asia/Shanghai"
    ports:
      - 3000:3000
      - 3001:3001
      - 3002:3002
      - 3003:3003
    # 启动指定自定义的配置文件
    command: [ "--config-file","/aerospike/aerospike.conf"]
    volumes:
      # 此处挂载了自定义的配置文件,用来启动时指定
      - ./data/aerospike-server/conf/aerospike.conf:/aerospike/aerospike.conf
      - ./data/aerospike-server/data/:/opt/aerospike/data/
      - ./data/aerospike-server/logs/:/logs/

编写aerospike配置文件

[root@localhost conf]# cat aerospike.conf
# Aerospike database configuration file.

# This stanza must come first.
service {
        user root
        group root
        paxos-single-replica-limit 1 # Number of nodes where the replica count is automatically reduced to 1.
        pidfile /var/run/aerospike/asd.pid
#       service-threads 4 # cpu x 5 in 4.7 
#       transaction-queues 4 # obsolete in 4.7 
#       transaction-threads-per-queue 4 # obsolete in 4.7
        proto-fd-max 15000
}

logging {

        # Log file must be an absolute path.
        file /logs/aerospike.log {
                context any info
        }
        # Send log messages to stdout
        console {
                context any info 
        }
}

network {
        service {
                address any
                port 3000

        }

        heartbeat {

                address any
                # mesh is used for environments that do not support multicast
                mode mesh
                port 3002

                # use asinfo -v 'tip:host=<ADDR>;port=3002' to inform cluster of
                # other mesh nodes

                interval 150
                timeout 10
        }

        fabric {
            address any
                port 3001
        }

        info {
                port 3003
        }


}

namespace ns1 {
        replication-factor 2
        memory-size 1G
        default-ttl 30d # 5 days, use 0 to never expire/evict.
        nsup-period 120
        #       storage-engine memory

        # To use file storage backing, comment out the line above and use the
        # following lines instead.

        storage-engine device {
                file /opt/aerospike/data/ns1.dat
                filesize 4G
                data-in-memory true # Store data in memory in addition to file.
        }
}

启动服务

sudo docker-compose up -d

查看docker 容器列表
sudo docker ps -a

# 查看日志
sudo docker logs [容器id]

# 查看挂载的数据目录
[root@localhost conf]# cd ../data/
[root@localhost data]# ll
总用量 8192
-rw------- 1 root root 4294967296  812 23:30 ns1.dat

# 查看挂载的日志目录
[root@localhost data]# cd ../logs/
[root@localhost logs]# ll
总用量 448
-rw------- 1 root root 200123  812 23:41 aerospike.log
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

咚个里个咚咚

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值