linux-docker

下载nacos

docker pull nacos/nacos-server:v2.2.3
`` ## 下载git脚本
```shell
cd /prod
mkdir nacos
git clone --depth 1 https://github.com/nacos-group/nacos-docker.git
cd nacos-docker

运行nacos

docker-compose -f example/standalone-derby.yaml up -d

没有grafana可以修改standalone-derby.yaml配置文件,删除grafana相关的配置。

version: "2"
services:
nacos:
image: nacos/nacos-server:${NACOS_VERSION}
container_name: nacos-standalone
environment:
- PREFER_HOST_MODE=hostname
- MODE=standalone
- NACOS_AUTH_IDENTITY_KEY=serverIdentity
- NACOS_AUTH_IDENTITY_VALUE=security
- NACOS_AUTH_TOKEN=SecretKey012345678901234567890123456789012345678901234567890123456789
volumes:
- ./standalone-logs/:/home/nacos/logs
ports:
- "8848:8848"
- "9848:9848"
restart: always

windows

下载nacos

这里使用2.2.3版本。

https://github.com/alibaba/nacos/releases

下载到本地并解压。

修改配置文件

需要依赖mysql数据库。

%nacos_home%/conf/application.properties

点击查看代码
#
# Copyright 1999-2021 Alibaba Group Holding Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# #*************** Spring Boot Related Configurations ***************#
### Default web context path:
server.servlet.contextPath=/nacos
### Include message field
server.error.include-message=ALWAYS
### Default web server port:
server.port=8848 #*************** Network Related Configurations ***************#
### If prefer hostname over ip for Nacos server addresses in cluster.conf:
# nacos.inetutils.prefer-hostname-over-ip=false ### Specify local server's IP:
# nacos.inetutils.ip-address= #*************** Config Module Related Configurations ***************#
### If use MySQL as datasource:
### Deprecated configuration property, it is recommended to use `spring.sql.init.platform` replaced.
# spring.datasource.platform=mysql
spring.sql.init.platform=mysql ### Count of DB:
db.num=1 ### Connect URL of DB:
db.url.0=jdbc:mysql://127.0.0.1:3306/nacos_config?characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useUnicode=true&useSSL=false&serverTimezone=UTC
db.user.0=root
db.password.0=123456 ### Connection pool configuration: hikariCP
db.pool.config.connectionTimeout=30000
db.pool.config.validationTimeout=10000
db.pool.config.maximumPoolSize=20
db.pool.config.minimumIdle=2 #*************** Naming Module Related Configurations ***************# ### If enable data warmup. If set to false, the server would accept request without local data preparation:
# nacos.naming.data.warmup=true ### If enable the instance auto expiration, kind like of health check of instance:
# nacos.naming.expireInstance=true ### Add in 2.0.0
### The interval to clean empty service, unit: milliseconds.
# nacos.naming.clean.empty-service.interval=60000 ### The expired time to clean empty service, unit: milliseconds.
# nacos.naming.clean.empty-service.expired-time=60000 ### The interval to clean expired metadata, unit: milliseconds.
# nacos.naming.clean.expired-metadata.interval=5000 ### The expired time to clean metadata, unit: milliseconds.
# nacos.naming.clean.expired-metadata.expired-time=60000 ### The delay time before push task to execute from service changed, unit: milliseconds.
# nacos.naming.push.pushTaskDelay=500 ### The timeout for push task execute, unit: milliseconds.
# nacos.naming.push.pushTaskTimeout=5000 ### The delay time for retrying failed push task, unit: milliseconds.
# nacos.naming.push.pushTaskRetryDelay=1000 ### Since 2.0.3
### The expired time for inactive client, unit: milliseconds.
# nacos.naming.client.expired.time=180000 #*************** CMDB Module Related Configurations ***************#
### The interval to dump external CMDB in seconds:
# nacos.cmdb.dumpTaskInterval=3600 ### The interval of polling data change event in seconds:
# nacos.cmdb.eventTaskInterval=10 ### The interval of loading labels in seconds:
# nacos.cmdb.labelTaskInterval=300 ### If turn on data loading task:
# nacos.cmdb.loadDataAtStart=false #*************** Metrics Related Configurations ***************#
### Metrics for prometheus
#management.endpoints.web.exposure.include=* ### Metrics for elastic search
management.metrics.export.elastic.enabled=false
#management.metrics.export.elastic.host=http://localhost:9200 ### 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 #*************** Access Log Related Configurations ***************#
### If turn on the access log:
server.tomcat.accesslog.enabled=true ### The access log pattern:
server.tomcat.accesslog.pattern=%h %l %u %t "%r" %s %b %D %{User-Agent}i %{Request-Source}i ### The directory of access log:
server.tomcat.basedir=file:. #*************** Access Control Related Configurations ***************#
### If enable spring security, this option is deprecated in 1.2.0:
#spring.security.enabled=false ### The ignore urls of auth
nacos.security.ignore.urls=/,/error,/**/*.css,/**/*.js,/**/*.html,/**/*.map,/**/*.svg,/**/*.png,/**/*.ico,/console-ui/public/**,/v1/auth/**,/v1/console/health/**,/actuator/**,/v1/console/server/** ### The auth system to use, currently only 'nacos' and 'ldap' is supported:
nacos.core.auth.system.type=nacos ### If turn on auth system:
nacos.core.auth.enabled=true ### Turn on/off caching of auth information. By turning on this switch, the update of auth information would have a 15 seconds delay.
nacos.core.auth.caching.enabled=true ### Since 1.4.1, Turn on/off white auth for user-agent: nacos-server, only for upgrade from old version.
nacos.core.auth.enable.userAgentAuthWhite=false ### Since 1.4.1, worked when nacos.core.auth.enabled=true and nacos.core.auth.enable.userAgentAuthWhite=false.
### The two properties is the white list for auth and used by identity the request from other server.
nacos.core.auth.server.identity.key=serverIdentity
nacos.core.auth.server.identity.value=security ### worked when nacos.core.auth.system.type=nacos
### The token expiration in seconds:
nacos.core.auth.plugin.nacos.token.cache.enable=false
nacos.core.auth.plugin.nacos.token.expire.seconds=18000
### The default token (Base64 String):
nacos.core.auth.plugin.nacos.token.secret.key=5L2g5piv6LCB5ZWKbmFjb3PlkJfkvaDmmK/osIHkvaDmmK/osIE= spring.cloud.nacos.config.import-check.enabled=true ### worked when nacos.core.auth.system.type=ldap,{0} is Placeholder,replace login username
#nacos.core.auth.ldap.url=ldap://localhost:389
#nacos.core.auth.ldap.basedc=dc=example,dc=org
#nacos.core.auth.ldap.userDn=cn=admin,${nacos.core.auth.ldap.basedc}
#nacos.core.auth.ldap.password=admin
#nacos.core.auth.ldap.userdn=cn={0},dc=example,dc=org
#nacos.core.auth.ldap.filter.prefix=uid
#nacos.core.auth.ldap.case.sensitive=true #*************** Istio Related Configurations ***************#
### If turn on the MCP server:
nacos.istio.mcp.server.enabled=false #*************** Core Related Configurations ***************# ### set the WorkerID manually
# nacos.core.snowflake.worker-id= ### Member-MetaData
# nacos.core.member.meta.site=
# nacos.core.member.meta.adweight=
# nacos.core.member.meta.weight= ### MemberLookup
### Addressing pattern category, If set, the priority is highest
# nacos.core.member.lookup.type=[file,address-server]
## Set the cluster list with a configuration file or command-line argument
# nacos.member.list=192.168.16.101:8847?raft_port=8807,192.168.16.101?raft_port=8808,192.168.16.101:8849?raft_port=8809
## for AddressServerMemberLookup
# Maximum number of retries to query the address server upon initialization
# nacos.core.address-server.retry=5
## Server domain name address of [address-server] mode
# address.server.domain=jmenv.tbsite.net
## Server port of [address-server] mode
# address.server.port=8080
## Request address of [address-server] mode
# address.server.url=/nacos/serverlist #*************** JRaft Related Configurations ***************# ### Sets the Raft cluster election timeout, default value is 5 second
# nacos.core.protocol.raft.data.election_timeout_ms=5000
### Sets the amount of time the Raft snapshot will execute periodically, default is 30 minute
# nacos.core.protocol.raft.data.snapshot_interval_secs=30
### raft internal worker threads
# nacos.core.protocol.raft.data.core_thread_num=8
### Number of threads required for raft business request processing
# nacos.core.protocol.raft.data.cli_service_thread_num=4
### raft linear read strategy. Safe linear reads are used by default, that is, the Leader tenure is confirmed by heartbeat
# nacos.core.protocol.raft.data.read_index_type=ReadOnlySafe
### rpc request timeout, default 5 seconds
# nacos.core.protocol.raft.data.rpc_request_timeout_ms=5000 #*************** Distro Related Configurations ***************# ### Distro data sync delay time, when sync task delayed, task will be merged for same data key. Default 1 second.
# nacos.core.protocol.distro.data.sync.delayMs=1000 ### Distro data sync timeout for one sync data, default 3 seconds.
# nacos.core.protocol.distro.data.sync.timeoutMs=3000 ### Distro data sync retry delay time when sync data failed or timeout, same behavior with delayMs, default 3 seconds.
# nacos.core.protocol.distro.data.sync.retryDelayMs=3000 ### Distro data verify interval time, verify synced data whether expired for a interval. Default 5 seconds.
# nacos.core.protocol.distro.data.verify.intervalMs=5000 ### Distro data verify timeout for one verify, default 3 seconds.
# nacos.core.protocol.distro.data.verify.timeoutMs=3000 ### Distro data load retry delay when load snapshot data failed, default 30 seconds.
# nacos.core.protocol.distro.data.load.retryDelayMs=30000 ### enable to support prometheus service discovery
#nacos.prometheus.metrics.enabled=true ### Since 2.3
#*************** Grpc Configurations ***************# ## sdk grpc(between nacos server and client) configuration
## Sets the maximum message size allowed to be received on the server.
#nacos.remote.server.grpc.sdk.max-inbound-message-size=10485760 ## Sets the time(milliseconds) without read activity before sending a keepalive ping. The typical default is two hours.
#nacos.remote.server.grpc.sdk.keep-alive-time=7200000 ## Sets a time(milliseconds) waiting for read activity after sending a keepalive ping. Defaults to 20 seconds.
#nacos.remote.server.grpc.sdk.keep-alive-timeout=20000 ## Sets a time(milliseconds) that specify the most aggressive keep-alive time clients are permitted to configure. The typical default is 5 minutes
#nacos.remote.server.grpc.sdk.permit-keep-alive-time=300000 ## cluster grpc(inside the nacos server) configuration
#nacos.remote.server.grpc.cluster.max-inbound-message-size=10485760 ## Sets the time(milliseconds) without read activity before sending a keepalive ping. The typical default is two hours.
#nacos.remote.server.grpc.cluster.keep-alive-time=7200000 ## Sets a time(milliseconds) waiting for read activity after sending a keepalive ping. Defaults to 20 seconds.
#nacos.remote.server.grpc.cluster.keep-alive-timeout=20000 ## Sets a time(milliseconds) that specify the most aggressive keep-alive time clients are permitted to configure. The typical default is 5 minutes
#nacos.remote.server.grpc.cluster.permit-keep-alive-time=300000

几个重要的配置

# 数据库配置 ,mysql新建nacos_config数据库,使用%nacos_home%/conf/mysql-schema.sql导入数据库脚本
spring.sql.init.platform=mysql
db.num=1
db.url.0=jdbc:mysql://127.0.0.1:3306/nacos_config?characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useUnicode=true&useSSL=false&serverTimezone=UTC
db.user.0=root
db.password.0=123456
# 是否开启鉴权功能,默认为false,这里改为true
nacos.core.auth.enabled=true
# 用于替换useragent白名单的身份识别key,随便写的,默认serverIdentity(2.2.1后无默认值)
nacos.core.auth.server.identity.key=serverIdentity
# 用于替换useragent白名单的身份识别value,随便写的,默认security(2.2.1后无默认值)
nacos.core.auth.server.identity.value=security ### 默认鉴权插件用于生成用户登陆临时accessToken所使用的密钥,长度设置大一点,不然会报错 (Base64 String):
nacos.core.auth.plugin.nacos.token.secret.key=5L2g5piv6LCB5ZWKbmFjb3PlkJfkvaDmmK/osIHkvaDmmK/osIE=
# 配置校验
spring.cloud.nacos.config.import-check.enabled=true

启动与停止

启动

cd %nacos_home%/bin
startup.cmd -m standalone

停止

点击shutdown.cmd即可运行,或者在启动的窗口按Ctrl+c

nacos安装的更多相关文章

  1. Nacos 安装(带视频)

    疯狂创客圈 Java 高并发[ 亿级流量聊天室实战]实战系列 [博客园总入口 ] 架构师成长+面试必备之 高并发基础书籍 [Netty Zookeeper Redis 高并发实战 ] 疯狂创客圈 高并 ...

  2. 【Nacos】Nacos安装

    1.Nacos简介 Nacos是阿里巴巴集团开源的一个易于使用的平台,专为动态服务发现,配置和服务管理而设计.它可以帮助您轻松构建云本机应用程序和微服务平台. Nacos基本上支持现在所有类型的服务, ...

  3. Nacos安装与启动

    一.官网下载 1. 地址 https://github.com/alibaba/nacos/releases   二.安装 将下载的安装包解压至非中文目录即可,解压后目录: bin 目录下有启动脚本, ...

  4. dubbo循序渐进 - nacos安装

    1.安装docker ce yum install -y yum-utils device-mapper-persistent-data lvm2 yum-config-manager --add-r ...

  5. NACOS安装和配置

    安装包nacos-server-1.1.4.tar.gz 环境 JDK1.8 上传及解压 [root@centos7- ~ ]# mkdir -p /cslc/nacos #通过SFTP将安装包上传至 ...

  6. Nacos安装与启动教程

    前言 Nacos是阿里巴巴集团开源的一个易于使用的平台,专为动态服务发现,配置和服务管理而设计,Nacos基本上支持现在所有类型的服务,例如,Dubbo / gRPC服务,Spring Cloud R ...

  7. Alibaba Nacos 学习(一):Nacos介绍与安装

    Alibaba Nacos 学习(一):Nacos介绍与安装 Alibaba Nacos 学习(二):Spring Cloud Nacos Config Alibaba Nacos 学习(三):Spr ...

  8. Spring Cloud Alibaba Nacos 入门

    概览 阿里巴巴在2018年7月份发布Nacos, Nacos是一个更易于构建云原生应用的动态服务发现.配置管理和服务管理平台.并表示在6-8个月完成到生产可用的0.8版本,目前版本是0.9版本. Na ...

  9. SpringBoot使用Nacos配置中心

    本文介绍SpringBoot如何使用阿里巴巴Nacos做配置中心. 1.Nacos简介 Nacos是阿里巴巴集团开源的一个易于使用的平台,专为动态服务发现,配置和服务管理而设计.它可以帮助您轻松构建云 ...

  10. nacos 使用记

    本文记录SpringBoot和SpringCloud与Nacos作为配置中心的整合过程及问题 Nacos官方使用文档:https://nacos.io/zh-cn/docs/what-is-nacos ...

随机推荐

  1. pkill 踢出某个终端

    是ps命令和kill命令的结合,按照进程名来杀死指定进程 选项 -o:仅向找到的最小(起始)进程号发送信号: -n:仅向找到的最大(结束)进程号发送信号: -P:指定父进程号发送信号: -g:指定进程 ...

  2. Luogu P11036 GCD 与 LCM 问题 [ 绿 ] [ 构造 ] [ 数论 ] [ adhoc ]

    Luogu P11036 GCD 与 LCM 问题:梦熊的题真是又神又逆天. 思路 观察到有个奇数的特殊性质,我们尝试从奇数构造入手. 先来尝试带入极端数据,对于 \(\gcd\),我们可以把 \(b ...

  3. DevExpress WPF 在RibbonControl的Header中添加搜索框

    主要代码: <dxb:BarEditItem Name="txtSearch" EditHorizontalAlignment="Center"> ...

  4. Springboot集成easypoi实现excel多sheet导出

    1.环境配置 <!--easypoi依赖,excel导入导出--> <dependency> <groupId>cn.afterturn</groupId&g ...

  5. Java8 stream 提取对象 List 中的某一字段生成新的 List

    //输出List StudentInfo.printStudents(studentList); //从对象列表中提取一列(以name为例) List<String> nameList = ...

  6. redis - [05] Java & Redis

    题记部分 一.准备工作 下载jedis.jar或者在maven配置文件中配置jar包依赖 二.连接redis import redis.clients.jedis.Jedis; public clas ...

  7. 使用 kubeadm 创建高可用 Kubernetes 及外部 etcd 集群

    博客链接:使用 kubeadm 创建高可用 Kubernetes 及外部 etcd 集群 前言 Kubernetes 的官方中文文档内容全面,表达清晰,有大量示例和解析 无论任何情况下都推荐先花几个小 ...

  8. 事务及mysql中的隔离级别

    事务,一个或一组sql语句组成的执行单元,是最小的执行单元,要么全执行,要么全不执行.如果单元中某条sql语句执行失败,整个单元将会回滚,所有受影响的数据返回到事务开始前的状态. 事务具有ACID四个 ...

  9. mysql [ERR] 1273 - Unknown collation: 'utf8mb4_0900_ai_ci'

    这是因为当前数据库版本较高,需要更改一些参数 解决方法: 将sql文件中的 utf8mb4_0900_ai_ci替换为utf8_general_ci utf8mb4替换为utf8 再次运行SQL文件即 ...

  10. webpack3使用additionalData和prependData都不管用

    10.css相关配置 utils.js sass: generateLoaders('sass', { indentedSyntax: true, implementation: require('n ...