Nacos client默认是支持安全控制的可以参考阿里云商业版配置中心ACM集成方式 https://github.com/alibaba/spring-cloud-alibaba/wiki/ACM 以及 spring cloud alibaba 配置项 https://github.com/alibaba/spring-cloud-alibaba/blob/master/spring-cloud-alibaba-examples/nacos-example/nacos-config-example/readme-zh.md 但是开源的Nacos并不含有安全控制模块,在Nacos plus里我们新增了兼容默认Nacos client的安全控制功能。
ACCESS_KEY和SECRET_KEY为nacos console的登录账号和加密后的密码。可以在users表中查得,密码产生方式可以参考com.alibaba.nacos.console.utils.PasswordEncoderUtil.main()代码
System.out.println(new BCryptPasswordEncoder().encode("nacos"));
SDK调用示例
Properties properties = new Properties();
properties.put(PropertyKeyConst.SERVER_ADDR, "localhost:8848");
properties.put(PropertyKeyConst.ACCESS_KEY, "nacos");
properties.put(PropertyKeyConst.SECRET_KEY, "$2a$10$EuWPZHzz32dJN7jexM34MOeYirDdFAZm2kuWj7VEOJhhZkDrxfvUu");
ConfigService configService = NacosFactory.createConfigService(properties);
spring-cloud-alibaba调用示例(配置文件或启动参数添加)
spring.cloud.nacos.config.accessKey=nacos
spring.cloud.nacos.config.secretKey=$2a$10$EuWPZHzz32dJN7jexM34MOeYirDdFAZm2kuWj7VEOJhhZkDrxfvUu
Nacos plus服务器开启安全控制功能(修改nacos/conf/application.properties配置)
# 开启配置中心安全认证
nacos.security.enableConfigSpasFilter=true
# 删除 忽略安全urls /v1/cs/**
nacos.security.ignore.urls=/,/**/*.css,/**/*.js,/**/*.html,/**/*.map,/**/*.svg,/**/*.png,/**/*.ico,/console-fe/public/**,/v1/auth/login,/v1/console/health/**,/v1/ns/**,/v1/cmdb/**,/actuator/**,/v1/console/server/**
Nacos (official site: http://nacos.io) is an easy-to-use platform designed for dynamic service discovery and configuration and service management. It helps you to build cloud native applications and microservices platform easily.
Service is a first-class citizen in Nacos. Nacos supports almost all type of services,for example,Dubbo/gRPC service、Spring Cloud RESTFul service or Kubernetes service.
Nacos provides four major functions.
-
Service Discovery and Service Health Check
Nacos makes it simple for services to register themselves and to discover other services via a DNS or HTTP interface. Nacos also provides real-time healthchecks of services to prevent sending requests to unhealthy hosts or service instance.
-
Dynamic Configuration Management
Dynamic Configuration Service allows you to manage configurations of all services in a centralized and dynamic manner across all environments. Nacos eliminates the need to redeploy applications and services when configurations are updated,which makes configuration changes more efficient and agile.
-
Dynamic DNS Service
Nacos supports weighted routing, making it easier for you to implement mid-tier load balancing, flexible routing policies, flow control, and simple DNS resolution services in the production environment within your data center. It helps you to implement DNS-based service discovery easily and prevent applications from coupling to vendor-specific service discovery APIs.
-
Service and MetaData Management
Nacos provides an easy-to-use service dashboard to help you manage your services metadata, configuration, kubernetes DNS, service health and metrics statistics.
It is super easy to get started with your first project.
You can download the package from the latest stable release.
Take release nacos-server-1.0.0.zip for example.
unzip nacos-server-1.0.0.zip
cd nacos/bin
On the Linux/Unix/Mac platform, run the following command to start server with standalone mode:
sh startup.sh -m standalone
On the Windows platform, run the following command to start server with standalone mode. Alternatively, you can also double-click the startup.cmd to run NacosServer.
cmd startup.cmd -m standalone
For more details, see quick-start.
You can view the full documentation from the Nacos website.
All the latest and long-term notice can also be found here from Github notice issue
Contributors are welcomed to join Nacos project. Please check CONTRIBUTING about how to contribute to this project.
- nacos-spring-project provides the integration functionality for Spring.
- nacos-group is the reposity that hosts the eco tools for Nacos, such as SDK, synchronization tool, etc.
- spring-cloud-alibaba provides the one-stop solution for application development over Alibaba middleware which includes Nacos.
- Gitter: Nacos's IM tool for community messaging, collaboration and discovery.
- Twitter: Follow along for latest nacos news on Twitter.
- Weibo: Follow along for latest nacos news on Weibo (Twitter of China version).
- Nacos Segmentfault: Get latest notice and prompt help from Segmentfault.
- Email Group:
- [email protected]: Nacos usage general discussion.
- [email protected]: Nacos developer discussion (APIs, feature design, etc).
- [email protected]: Commits notice, very high frequency.
- Join us from DingDing.
These are only part of the companies using Nacos, for reference only. If you are using Nacos, please add your company here to tell us your scenario to make Nacos better.