aliyun在docker容器服务里配置elasticsearch5

第一步,制作镜像。官方镜像没有x-pack。

FROM kibana:5.6.3
ENV TIME_ZONE Asia/Shanghai
RUN cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
&& echo "${TIME_ZONE}" > /etc/timezone
RUN kibana-plugin install x-pack
EXPOSE 5601

第二部,多节点发布
这里举例发布一个主节点,一个数据节点。
aliyun的容器里配置

elasticsearch:
      container_name: elasticsearch
      restart: always
      environment:

        - LANG=C.UTF-8
        - JAVA_HOME=/docker-java-home/jre

        - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
      expose:
        - '9200:9200/tcp'
        - '9300:9300/tcp'
      memswap_limit: 0
      labels:
        aliyun.scale: '1'
      command:

        - elasticsearch 
        - '-E'
        - cluster.name=searcher #所有节点设置成一样的
        - '-E'
        - node.master=true #主节点true,数据节点false
        - '-E'
        - node.name=elasticsearch #节点名不能一样
  
        - '-E'
        - network.host=172.19.0.27#这里需要些容器的ip否则互相找不到,而且不能加引号
        - '-E'
        - discovery.zen.ping.unicast.hosts=172.19.0.32:9300 #互相发现的节点和ip
      shm_size: 0
      #image: 'elasticsearch:5.6.3' #如果不装或手动装xpack的话可以用官方镜像。官方镜像安装xpack比较消内存,可能因内存不足提示killed安装失败。
      image: 'xx[这里是你的镜像]x/elastic_search:0.1.0'
      memswap_reservation: 0
      volumes:
        - esdata1:/usr/share/elasticsearch/data
      kernel_memory: 0
      mem_limit: 0

phabricator 无法安装在阿里云rds上

phabricator 报如下错误
Replicating Master
Database host “[数据库地址]” is configured as a master, but is replicating another host. This is dangerous and can mangle or destroy data. Only replicas should be replicating. Stop replication on the host or reconfigure Phabricator.

然后发现原因是RDS自动做了主从备份,据说还是双向,而且无法关闭。
只能从程序下手了,搜索代码发现在

switch ($ref->getReplicaStatus()) {
      case PhabricatorDatabaseRef::REPLICATION_MASTER_REPLICA:
     break;<----新增的
        $message = pht(
          'Database host "%s" is configured as a master, but is replicating '.
          'another host. This is dangerous and can mangle or destroy data. '.
          'Only replicas should be replicating. Stop replication on the '.
          'host or reconfigure Phabricator.',
 $ref->getRefKey());

https://secure.phabricator.com/source/phabricator/browse/master/src/applications/config/check/PhabricatorDatabaseSetupCheck.php;326d5bf8004ece51fbb44146766f5ddf765f1159
这个文件的174行左右判断验证了

然后我在case后直接写了个break,绕过了验证,反正是可以用了