Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/docker/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
docker上的多个aerospike节点_Docker_Aerospike - Fatal编程技术网

docker上的多个aerospike节点

docker上的多个aerospike节点,docker,aerospike,Docker,Aerospike,我希望有多个aerospike服务器节点的实例,以便实现负载平衡,因为我使用了太多的请求访问服务器,因此收到了一个错误:“错误代码22:此时不允许操作” 我假设有更多的aerospike服务器节点可以减轻一个节点上的负载,从而完成更多的操作?我不知道从哪里开始 我需要这些节点都在一台主机上本地运行。任何帮助都会很好 我的网络知识不是很好,所以请原谅我的任何错误 我的DockerFile: FROM aerospike/aerospike-server MAINTAINER "xxxx" AD

我希望有多个aerospike服务器节点的实例,以便实现负载平衡,因为我使用了太多的请求访问服务器,因此收到了一个错误:“错误代码22:此时不允许操作”

我假设有更多的aerospike服务器节点可以减轻一个节点上的负载,从而完成更多的操作?我不知道从哪里开始

我需要这些节点都在一台主机上本地运行。任何帮助都会很好

我的网络知识不是很好,所以请原谅我的任何错误

我的DockerFile:

FROM aerospike/aerospike-server

MAINTAINER "xxxx"

ADD aerospike.conf /etc/aerospike/
docker-compose.yml

version: "3"

services:
   aerospike-server:
      image: amc
      container_name: aerospike-server
      ports:
      - "3000:3000"
      - "3001:3001"
      - "3002:3002"
      - "3003:3003"
   aerospike-amc:
      image: mrbar42/aerospike-amc
      container_name: aerospike-amc
      ports:
      - "8081:8081"
aerospike.conf网络节

network {
    service {
        address any
        port 3000

        # Uncomment the following to set the `access-address` parameter to the
        # IP address of the Docker host. This will the allow the server to correctly
        # publish the address which applications and other nodes in the cluster to
        # use when addressing this node.
        # access-address <IPADDR>
    }

    heartbeat {

        # 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 {
        # address any
        port 3003
    }
}
网络{
服务{
解决任何问题
端口3000
#取消注释以下内容以将“访问地址”参数设置为
#Docker主机的IP地址。这将允许服务器正确运行
#发布群集中的应用程序和其他节点要发布的地址
#在寻址此节点时使用。
#访问地址
}
心跳{
#mesh用于不支持多播的环境
模式网格
端口3002
#使用asinfo-v'tip:host=;port=3002'通知集群
#其他网格节点
间隔150
超时10
}
织物{
#解决任何问题
端口3001
}
信息{
#解决任何问题
端口3003
}
}

您可以使用多播心跳配置,在一台机器上运行一小群aerospike节点

以下是我使用的步骤:

1) 从aerospike repo获取最新Dockerfile

git克隆

2) 修改heartbeat部分并使用多播:

    heartbeat {

            mode multicast
            multicast-group 239.1.99.2
            port 9918

            interval 150
            timeout 10
    }
3) 使用docker compose或自定义脚本构建映像和集群

我使用了以下自定义makecluster.sh bash shell脚本:

cat makecluster.sh 
docker build -t "aerospike/aerospike-server" .
for i in {3..9} ; do
echo $i;
docker stop aerospike${i}
docker rm aerospike${i}
docker run -tid --name aerospike${i} -p ${i}000:3000 -p ${i}001:3001 -p ${i}002:3002 -p ${i}003:3003 aerospike/aerospike-server
done;
并运行:

 ./makecluster.sh 
Sending build context to Docker daemon  12.8 kB
Step 1/10 : FROM ubuntu:xenial
 ---> 2fa927b5cdd3
Step 2/10 : ENV AEROSPIKE_VERSION 3.12.1
 ---> Using cache
 ---> f9740fe0e5b5
Step 3/10 : ENV AEROSPIKE_SHA256 16ceb0d131892c3caab31ee031f7e37d7a611c22686fec2692facde87ac69a00
 ---> Using cache
 ---> 5e7fbc820f7a
Step 4/10 : RUN apt-get update -y   && apt-get install -y wget python python-argparse python-bcrypt python-openssl logrotate net-tools iproute2 iputils-ping   && wget "https://www.aerospike.com/artifacts/aerospike-server-community/${AEROSPIKE_VERSION}/aerospike-server-community-${AEROSPIKE_VERSION}-ubuntu16.04.tgz" -O aerospike-server.tgz   && echo "$AEROSPIKE_SHA256 *aerospike-server.tgz" | sha256sum -c -   && mkdir aerospike   && tar xzf aerospike-server.tgz --strip-components=1 -C aerospike   && dpkg -i aerospike/aerospike-server-*.deb   && dpkg -i aerospike/aerospike-tools-*.deb   && mkdir -p /var/log/aerospike/   && mkdir -p /var/run/aerospike/   && rm -rf aerospike-server.tgz aerospike /var/lib/apt/lists/*   && dpkg -r wget ca-certificates   && dpkg --purge wget ca-certificates   && apt-get purge -y
 ---> Using cache
 ---> a1d797e088fa
Step 5/10 : COPY aerospike.conf /etc/aerospike/aerospike.conf
 ---> Using cache
 ---> 7bb9f5326c7b
Step 6/10 : COPY entrypoint.sh /entrypoint.sh
 ---> Using cache
 ---> 345534f6c3b8
Step 7/10 : VOLUME /opt/aerospike/data
 ---> Using cache
 ---> 3f07a5e4b113
Step 8/10 : EXPOSE 3000 3001 3002 3003
 ---> Using cache
 ---> e081dff6a725
Step 9/10 : ENTRYPOINT /entrypoint.sh
 ---> Using cache
 ---> 923ff0299e70
Step 10/10 : CMD asd
 ---> Using cache
 ---> a05c71468897
Successfully built a05c71468897
3
aerospike3
aerospike3
4d2df0569581c967d29750a5f7f6e67fc1835e1f6b78157eb5c8b11f843a222b
4
aerospike4
aerospike4
3173f06d9012996ce318855d982fbc20c5985beb7e356863a0075ce3ae337b21
5
aerospike5
aerospike5
10592f8ca508c678cd67695402f3c23ad417716772cf5a20de91c3e178bb1c28
6
aerospike6
aerospike6
7ddac9e31db5b618114c155b40d8ad524b629e96c514837a36854cf420a29d5c
7
aerospike7
aerospike7
6168421deffead460ac238b2a9817769e29d3c68eca33863cf9b0e19a8c09a0f
8
aerospike8
aerospike8
9d1761592c30b1460c064ef06f70067217e1b1c61f3efc2b016113b4869cfc6f
9
aerospike9
aerospike9
67c37f2f6ebae065eef978dcf4683b6ad5bd18bed0411e3d6681c723776c1834
5) 验证群集信息:

使用docker exec运行asadm工具

docker exec -ti aerospike7 asadm
Aerospike Interactive Shell, version 0.1.9

Found 7 nodes
Online:  172.17.0.2:3000, 172.17.0.8:3000, 172.17.0.3:3000, 172.17.0.4:3000, 172.17.0.7:3000, 172.17.0.6:3000, 172.17.0.5:3000

Admin> 


Admin> info
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Network Information~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
             Node               Node                Ip      Build   Cluster            Cluster     Cluster         Principal   Rackaware   Client     Uptime   
                .                 Id                 .          .      Size                Key   Integrity                 .        Mode    Conns          .   
172.17.0.2:3000     BB9020011AC4202    172.17.0.2:3000   C-3.12.1         7   8DBD43898C508D41   True        BB9080011AC4202   none             7   00:06:03   
172.17.0.3:3000     BB9030011AC4202    172.17.0.3:3000   C-3.12.1         7   8DBD43898C508D41   True        BB9080011AC4202   none             8   00:06:02   
172.17.0.4:3000     BB9040011AC4202    172.17.0.4:3000   C-3.12.1         7   8DBD43898C508D41   True        BB9080011AC4202   none             8   00:06:00   
172.17.0.5:3000     BB9050011AC4202    172.17.0.5:3000   C-3.12.1         7   8DBD43898C508D41   True        BB9080011AC4202   none             6   00:05:58   
172.17.0.7:3000     BB9070011AC4202    172.17.0.7:3000   C-3.12.1         7   8DBD43898C508D41   True        BB9080011AC4202   none            10   00:05:55   
172.17.0.8:3000     *BB9080011AC4202   172.17.0.8:3000   C-3.12.1         7   8DBD43898C508D41   True        BB9080011AC4202   none             6   00:05:52   
6168421deffe:3000   BB9060011AC4202    172.17.0.6:3000   C-3.12.1         7   8DBD43898C508D41   True        BB9080011AC4202   none             8   00:05:56   
Number of rows: 7

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Namespace Information~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Namespace                Node   Avail%   Evictions                 Master                Replica     Repl     Stop             Pending       Disk    Disk     HWM        Mem     Mem    HWM      Stop   
        .                   .        .           .   (Objects,Tombstones)   (Objects,Tombstones)   Factor   Writes            Migrates       Used   Used%   Disk%       Used   Used%   Mem%   Writes%   
        .                   .        .           .                      .                      .        .        .             (tx,rx)          .       .       .          .       .      .         .   
test        172.17.0.2:3000     99         0.000     (0.000  ,0.000  )      (0.000  ,0.000  )      2        false    (0.000  ,0.000  )   0.000 B    0       50      0.000 B    0       60     90        
test        172.17.0.3:3000     99         0.000     (0.000  ,0.000  )      (0.000  ,0.000  )      2        false    (0.000  ,0.000  )   0.000 B    0       50      0.000 B    0       60     90        
test        172.17.0.4:3000     99         0.000     (0.000  ,0.000  )      (0.000  ,0.000  )      2        false    (0.000  ,0.000  )   0.000 B    0       50      0.000 B    0       60     90        
test        172.17.0.5:3000     99         0.000     (0.000  ,0.000  )      (0.000  ,0.000  )      2        false    (0.000  ,0.000  )   0.000 B    0       50      0.000 B    0       60     90        
test        172.17.0.7:3000     99         0.000     (0.000  ,0.000  )      (0.000  ,0.000  )      2        false    (0.000  ,0.000  )   0.000 B    0       50      0.000 B    0       60     90        
test        172.17.0.8:3000     99         0.000     (0.000  ,0.000  )      (0.000  ,0.000  )      2        false    (0.000  ,0.000  )   0.000 B    0       50      0.000 B    0       60     90        
test        6168421deffe:3000   99         0.000     (0.000  ,0.000  )      (0.000  ,0.000  )      2        false    (0.000  ,0.000  )   0.000 B    0       50      0.000 B    0       60     90        
test                                       0.000     (0.000  ,0.000  )      (0.000  ,0.000  )                        (0.000  ,0.000  )   0.000 B                    0.000 B                             
Number of rows: 8
注意:如果在主机上的docker容器外部运行,像AMC或asadm这样的工具可能无法看到整个集群。在这种情况下,您可能需要在aerospike.conf中尝试docker主机网络和不同的侦听端口,或者在容器中运行AMC

6) 如果使用--network=host,则需要修改aerospike.conf中的侦听端口。在使用主机网络时,在具有相同ip地址的同一主机上运行的每个实例应使用不同的端口

例如:

cat makecluster.sh 
docker build -t "aerospike/aerospike-server" .
for i in {6..9} ; do
echo $i;
docker stop aerospike${i}
docker rm aerospike${i}
docker run -tid --name aerospike${i} -v /root/docker/aerospike-server.docker/aerospike${i}:/etc/aerospike --network host -p ${i}000:${i}000 -p ${i}001:${i}001 -p ${i}002:${i}002 -p ${i}003:${i}003 aerospike/aerospike-server
done;
示例配置目录和文件:

cat aerospike7/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
    transaction-queues 4
    transaction-threads-per-queue 4
    proto-fd-max 15000
}

logging {

    # Log file must be an absolute path.
    file /var/log/aerospike/aerospike.log {
        context any info
    }

    # Send log messages to stdout
    console {
        context any info 
    }
}

network {
    service {
        # Add interface name for network card used by host
        address br0 
        # Modify port to be used by your aerospike container
        port 7000

        # Uncomment the following to set the `access-address` parameter to the
        # IP address of the Docker host. This will the allow the server to correctly
        # publish the address which applications and other nodes in the cluster to
        # use when addressing this node.
        # access-address <IPADDR>
    }

    heartbeat {


            mode multicast
            multicast-group 239.1.99.2
            port 9918


        interval 150
        timeout 10
    }

    fabric {
        # Modify port to be used by your aerospike container
        port 7001
    }

    info {
        # Modify port to be used by your aerospike container
        port 7003
    }
}

namespace test {
    replication-factor 2
    memory-size 1G
    default-ttl 5d # 5 days, use 0 to never expire/evict.

    #   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/test.dat
        filesize 4G
        data-in-memory true # Store data in memory in addition to file.
    }
}

你能发布完整的错误代码22错误吗。似乎您可能正在运行太多的扫描,并且可能还需要调整您的扫描设置,看看您是否已达到任何proto fd max限制,这将是一件有趣的事情。通过在同一节点上的不同端口上配置docker实例,您肯定可以尝试更多docker实例。不幸的是,这是我得到的全部错误。是的,我做了很多扫描。这就是我试图实现的,运行更多节点,但不太确定如何实现。您可以尝试增加扫描最大活动和扫描线程数:您使用的是覆盖网络还是docker主机网络?运行另一个实例可能取决于您的配置类型。你可以发布你的docker run和dockerfile以及你的问题吗?我已经将scan maxactive&done增加到200(似乎是限制),并将扫描线程增加到8个,不会再出现任何错误,但这个过程似乎需要更长的时间。我正在使用docker主机网络。我已经更新了我的问题。由于您在同一台主机上,您可以将实例配置为使用多播网络:并将每个docker实例配置为使用不同的端口。(即:对于3节点集群,3个单独的aerospike.conf,其中包含:3000-3003、4000-4003和5000-5003)请参阅:太好了,谢谢。我现在可以在日志中看到集群大小为7。我只需要在AMC上看到这个集群。我已经构建了一个amc容器,但它似乎无法检测到节点。好吧,我只需将它们添加到我的撰写文件中,就可以让它们工作,但我似乎不能同时拥有超过7个节点?
asadm -p 7000
Aerospike Interactive Shell, version 0.1.9

Found 4 nodes
Online:  192.168.100.148:9000, 192.168.100.148:7000, 192.168.100.148:8000, 192.168.100.148:6000

Admin> info
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Network Information~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                     Node                Node                     Ip      Build   Cluster            Cluster     Cluster          Principal   Rackaware   Client     Uptime   
                        .                  Id                      .          .      Size                Key   Integrity                  .        Mode    Conns          .   
node.local:6000   177160DE04CA0568    192.168.120.148:6000   C-3.12.1         4   5009B1D835FA3C06   True        232960DE04CA0568   none             3   00:28:37   
node.local:7000   1B5960DE04CA0568    192.168.120.148:7000   C-3.12.1         4   5009B1D835FA3C06   True        232960DE04CA0568   none             3   00:28:34   
node.local:8000   1F4160DE04CA0568    192.168.120.148:8000   C-3.12.1         4   5009B1D835FA3C06   True        232960DE04CA0568   none             3   00:28:30   
node.local:9000   *232960DE04CA0568   192.168.120.148:9000   C-3.12.1         4   5009B1D835FA3C06   True        232960DE04CA0568   none             4   00:28:25   
Number of rows: 4

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Namespace Information~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Namespace                        Node   Avail%   Evictions                 Master                Replica     Repl     Stop             Pending       Disk    Disk     HWM        Mem     Mem    HWM      Stop   
        .                           .        .           .   (Objects,Tombstones)   (Objects,Tombstones)   Factor   Writes            Migrates       Used   Used%   Disk%       Used   Used%   Mem%   Writes%   
        .                           .        .           .                      .                      .        .        .             (tx,rx)          .       .       .          .       .      .         .   
test        node.local:6000   99         0.000     (0.000  ,0.000  )      (0.000  ,0.000  )      2        false    (0.000  ,0.000  )   0.000 B    0       50      0.000 B    0       60     90        
test        node.local:7000   99         0.000     (0.000  ,0.000  )      (0.000  ,0.000  )      2        false    (0.000  ,0.000  )   0.000 B    0       50      0.000 B    0       60     90        
test        node.local:8000   99         0.000     (0.000  ,0.000  )      (0.000  ,0.000  )      2        false    (0.000  ,0.000  )   0.000 B    0       50      0.000 B    0       60     90        
test        node.local:9000   99         0.000     (0.000  ,0.000  )      (0.000  ,0.000  )      2        false    (0.000  ,0.000  )   0.000 B    0       50      0.000 B    0       60     90        
test                                               0.000     (0.000  ,0.000  )      (0.000  ,0.000  )                        (0.000  ,0.000  )   0.000 B                    0.000 B