• nacos-server安装、运行 (docker)


    https://nacos.io/en-us/docs/quick-start-docker.html
    https://github.com/nacos-group/nacos-docker

    mkdir /opt/nacos-server/init.d -p

    vim /opt/nacos-server/Dockerfile

    FROM nacos/nacos-server:1.1.4
    EXPOSE 8848 9555

    vim /opt/nacos-server/home/nacos/init.d/custom.properties

    #spring.security.enabled=false
    #management.security=false
    #security.basic.enabled=false
    #nacos.security.ignore.urls=/**
    
    # metrics for prometheus
    management.endpoints.web.exposure.include=*
    
    # metrics for elastic search
    management.metrics.export.elastic.enabled=true
    management.metrics.export.elastic.host=http://elasticsearchserver:9201
    management.metrics.export.elastic.user-name=elastic
    management.metrics.export.elastic.password=123456
    management.metrics.export.elastic.index=nacosserver-metrics
    management.metrics.export.elastic.auto-create-index=true
    management.metrics.export.elastic.batch-size=10000
    management.metrics.export.elastic.connect-timeout=1s
    management.metrics.export.elastic.index-date-format=yyyy-MM
    management.metrics.export.elastic.num-threads=2
    management.metrics.export.elastic.read-timeout=10s
    management.metrics.export.elastic.step=1m
    management.metrics.export.elastic.timestamp-field-name=@timestamp
    
    # metrics for influx
    #management.metrics.export.influx.enabled=false
    #management.metrics.export.influx.db=springboot
    #management.metrics.export.influx.uri=http://localhost:8086
    #management.metrics.export.influx.auto-create-db=true
    #management.metrics.export.influx.consistency=one
    #management.metrics.export.influx.compressed=true

    sudo mkdir -p /var/log/nacos;sudo chmod -R 777 /var/log/nacos

    vim /opt/nacos-server/docker-compose.yml

    version: "2"
    services:
      nacos:
        image: v-nacos-server
        container_name: nacos-server
        build: 
          context: .
          dockerfile: Dockerfile
        environment:
          - MODE=standalone
          - PREFER_HOST_MODE=hostname
          - NACOS_SERVER_PORT=8848
          - SPRING_DATASOURCE_PLATFORM=mysql
          - MYSQL_MASTER_SERVICE_HOST=mysqlserver
          - MYSQL_MASTER_SERVICE_PORT=3306
          - MYSQL_MASTER_SERVICE_DB_NAME=nacos_config
          - MYSQL_MASTER_SERVICE_USER=root
          - MYSQL_MASTER_SERVICE_PASSWORD=root
          - MYSQL_SLAVE_SERVICE_HOST=mysqlserver
          - MYSQL_SLAVE_SERVICE_PORT=3306
          - MYSQL_DATABASE_NUM=2
          - JVM_XMS=512m
          - JVM_XMX=512m
          - JVM_XMN=256m
          - JVM_MS=32m
          - JVM_MMS=80m
          - NACOS_DEBUG=n
          - TOMCAT_ACCESSLOG_ENABLED=false
        volumes:
          - /var/log/nacos:/home/nacos/logs
          - ./home/nacos/init.d/custom.properties:/home/nacos/init.d/custom.properties
        ports:
          - "8848:8848"
          - "9555:9555"
        restart: on-failure
        extra_hosts:
          - "mysqlserver:192.168.0.101"
          - "elasticsearchserver:192.168.0.101"

    cd /opt/nacos-server
    docker-compose build
    docker-compose up -d --force-recreate
    docker-compose down
    docker-compose restart

    查看日志
    docker logs --tail="500" nacos-server

    查看进程
    netstat -anltp|grep 8848

    进入容器
    docker exec -it nacos-server /bin/bash

    集群配置参照:
    https://nacos.io/en-us/docs/quick-start-docker.html
    https://github.com/nacos-group/nacos-docker

  • 相关阅读:
    Struts2
    HIbernate缓存
    spring的静态代理和动态代理
    JVM与垃圾回收机制(GC)和类的生命周期
    java开发设计六大基本原则
    数据表链表结构
    HashMap的底层实现
    string与位运算
    log4j和logback
    C#深入类的方法
  • 原文地址:https://www.cnblogs.com/wintersoft/p/11234073.html
Copyright © 2020-2023  润新知