【springcloud 微服务】Spring Cloud Alibaba Nacos使用详解

目录

一、前言

二、nacos介绍

2.1  什么是 Nacos

2.2 nacos 核心能力

2.2.1 服务发现和服务健康监测

2.2.2 动态配置服务

2.2.3 动态 DNS 服务

2.2.4 服务及其元数据管理

2.2.5 nacos生态地图

2.3 与其他配置中心对比

三、nacos快速部署

3.1 获取安装包

3.2 修改脚本启动模式

3.3  启动nacos 服务

3.4 访问控制台

四、连接mysql

4.1 前置准备

4.2 操作步骤

4.2.1 导入安装包下nacos的建表sql

4.2 修改配置文件

4.3 重启nacos服务

五、nacos配置管理

5.1 配置管理菜单

5.1.1 配置列表

5.1.2 历史版本

六、nacos权限管理

6.1 用户

6.2 角色

6.3 权限

七、nacos命名空间

7.1 创建命名空间

7.2 创建配置文件

八、Spring Cloud 使用 Nacos

8.1  前置准备

8.2  读取nacos配置

8.2.1 配置文件

8.2.2 nacos添加一个配置文件

8.2.3 添加测试接口

8.2.4 模拟测试

8.3  namespace与group使用

8.3.1 同一个namespace不同dataid

8.3.2 不同namespace的配置读取

 8.3.3 不同group的配置读取

8.4  nacos动态刷新配置

 九、写在最后


一、前言

nacos作为Spring Cloud Alibaba微服务体系中一个非常重要的组件,在微服务治理中担当着不可替代的角色,比如作为分布式配置中心,服务注册中心,相比其他的配置中心和注册中心来说,nacos具有更出色的性能以及云原生优势,本篇将从多个维度全面深入的学习nacos这个组件。

二、nacos介绍

nacos官网:nacos官网 ,中文参考手册地址:中文手册

2.1  什么是 Nacos

  • Nacos 致力于帮助您发现、配置和管理微服务。帮助您快速实现动态服务发现、服务配置、服务元数据及流量管理;
  • Nacos 帮助您更敏捷和容易地构建、交付和管理微服务平台。 Nacos 是构建以“服务”为中心的
Spring-Cloud-Starter-Alibaba-Nacos-Discovery 源码分析 关于 Spring-Cloud-Starter-Alibaba-Nacos-Discovery 在应用启动时,自动注册服务的一些相关的源码分析。 阅读详情

相关推荐

Spring Cloud Alibaba实战:从零搭建Nacos+Gateway+OpenFeign微服务架构(2024最新版)

本文提供了一份2024年最新的Spring Cloud Alibaba实战指南,详细讲解如何从零搭建基于Nacos、Spring Cloud Gateway和OpenFeign的现代化微服务架构。内容涵盖架构选型、环境准备、服务注册发现、声明式服务调用、API网关配置以及Nacos动态配置管理,并适配Spring Boot 3.2与JDK 17,帮助开发者构建高效、可维护的云原生应用。

weixin_29275257的博客 347

云原生微服务实战 Spring Cloud Alibaba 之 Nacos

云原生微服务治理有很多手段,但在Java生态里,最主流的还是Spring Cloud Alibaba 、Spring Cloud Netflix。 Spring Cloud文章的前部分已经把Spring Cloud Netflix相关组件讲解且实践过了,这章我们讲解了Spring Cloud Alibaba的Nacos discovery,后续还会继续讲解完Spring Cloud Alibaba其他组件。

Java 技术专栏,从入门到精通,熟悉企业级开发 3万+

Spring Cloud Alibaba 实战:从0到1搭建企业级微服务架构(附踩坑实录+生产级优化)

在企业级开发中,微服务架构已成为解决单体应用臃肿、扩展性差、迭代缓慢的核心方案。而Spring Cloud Alibaba作为国内最主流的微服务生态,凭借其与Spring生态的无缝兼容、组件的稳定性与本土化适配(如Nacos、Sentinel),成为绝大多数中大型企业的首选。

2601_94871597的博客 683

二期 1.3 Spring Cloud Alibaba微服务组件Nacos注册中心介绍

对于Spring Cloud Alibaba来说,Nacos是首选,因为它是Spring Cloud Alibaba微服务组件中标配的注册中心,也是阿里开源的非常重要的微服务组件,不止可以做注册中心,也可以做配置中心。当一个服务启动时,它会向注册中心注册自己的服务实例信息,包括服务名称、IP地址、端口号等。服务元数据是指包括服务端点(endpoints)、服务标签、服务版本号、服务实例权重、路由规则、安全策略等描述服务的数据。话说微服务架构下 服务的数量都是非常多的,而且服务的实例数量也可能会动态变化。

天罡gg的专栏 4117

Spring Cloud Alibaba 整合Nacos实战

Spring Cloud Alibaba 整合Nacos

congge_study的博客 7898

【springcloud 微服务】Spring Cloud Alibaba整合Sentinel详解

Spring Cloud Alibaba整合Sentinel详解

congge_study的博客 6853

Spring Cloud Alibaba微服务架构实战:Nacos+Feign+Gateway+Sentinel

微服务架构是一种将单体应用拆分为多个小型、独立服务的设计模式,每个服务可独立开发、部署与扩展。相比传统单体架构,微服务提升了系统的可维护性、弹性与可伸缩性。作为 Spring Cloud 的扩展方案,整合了阿里巴巴生态中的多个中间件组件,如 Nacos(注册与配置中心)、Sentinel(限流熔断)、Seata(分布式事务)等,为构建高可用的微服务系统提供了完整解决方案。

weixin_29867767的博客 1254

unity中基于NGUI实现一张图片上在某个地方挖个洞

按照策划的要求,引导时只有被引导的图片是高亮的,其余地方都是黑色半透明,如下图所示: 对应的实现shader如下: Shader "Unlit/TutorialBg" { Properties { _MainTex ("Base (RGB), Alpha (A)", 2D) = "black" {} _ClipRange0 ("Clip Vector

手机游戏开发 3698

Cadence Virtuoso实战:NMOS差分放大器设计与SPICE仿真全解析

本文详细解析了使用Cadence Virtuoso设计NMOS差分放大器并进行SPICE仿真的全流程。从基础设计要点、原理图绘制到工作点分析与性能调优,提供了实用的设计技巧和常见问题解决方案,帮助工程师高效完成模拟集成电路设计。重点介绍了差分放大器的关键参数设置、饱和区优化及版图设计注意事项,适用于ADC、DAC等高性能电路开发。

weixin_28340315的博客 611

H医药公司配送中心布局仿真优化

新增2个Source,Source1命名为“货物到达”,用来进行仿真供应商原料到达,Source2命名为“订单到达”,用来进行仿真客户需求订单的到达,如下图是设置两个发生器的具体参数。通过主操作界面上的各个实体工具,如发生器、暂存区、货架、处理器、吸收器等实体工具对初始模型和优化后的方案模型进行仿真建模,建立优化前后的模型图如下图所示。通过下表可以看出,优化前操作员的总运行距离为132.11km,而优化后操作员的总运行距离为128.17km,运行距离缩短,操作员的疲劳强度降低。

m0_72514516的博客 2529

告别Link180!在Ansys Mechanical 2020R2中正确启用Cable280绳索单元(附Beta选项开启指南)

本文详细介绍了在Ansys Mechanical 2020R2中启用Cable280绳索单元的全过程,包括Beta选项的开启步骤、建模技巧及高阶应用。Cable280作为专为绳索仿真设计的单元,相比传统的Link180单元,在大变形模拟和计算效率上表现更优,特别适合斜拉桥、电梯牵引绳等工程场景。

weixin_33711647的博客 405

欧姆龙PLC与fanuc发那科机器人进行Ethrenet ip通信测试

近期在做发那科FANUC的通讯,会吧CC-LINK、Profibus-DP、Profinet I/O、DeviceNet、EtherNet/IP这些常用通讯做成文档发上来,大家喜欢的话可以关注 注:做对应的通讯,在机器人控制柜都需要安装对应的板卡以及软件功能 截图中的程序设置和机器人EDS插件在下面链接 https://download.youkuaiyun.com/download/gojava/13770799 PLC为主站 机器人为从站 一、硬件部分 欧姆龙PLC ...

七兔自习室 1万+

72、海洋地理信息系统:电子海图的全面解析

本文全面解析了海洋地理信息系统中的电子海图技术,从AIS数据的应用、电子海图数据的存储与显示,到电子导航的发展趋势和S-100通用水文数据模型的推广,系统地阐述了电子海图在现代航海中的核心作用及其未来发展方向。

hhh00的博客 252

上线之前多一道闸:业务审核系统的接入定义、双轨状态机与可靠生效闭环

运营后台“保存即生效”,让价格、库存、人群等配置每次修改都相当于一次无评审的上线。本文以至尊会员降价活动为例,系统拆解业务审核系统:用带业务语义的操作编码、规则化审核人与候选人快照、完整的生效回调契约做好接入定义;把业务改造为提交待生效,以不可变快照、字段级差异和唯一约束加幂等号防误配防重复;用审批轨与执行轨双轨状态机、链路式重新提交和以事件为准的审核链路理清状态;最后以发件箱、幂等键、超时先查后试、乐观锁与对账闭合生效环节,并结合两个可运行的Java程序,给出五种生效策略的事故率实测对比。

曾经“等你生日那天”都遥远得像未来,如今却可欢愉的挥手说“下个十年见” 6万+

网络安全与黑客攻防常见设备:前置机、跳板机、堡垒机与肉鸡

前置机、跳板机、堡垒机和肉鸡,这些看似冷僻的技术名词,实则是网络安全与黑客攻防战中的关键角色。它们有的守护着企业的数字Pltform,保卫网络安全;有的则成为黑客的跳板,游走于灰色地带。

网络技术联盟站 962

迈瑞BS系列全自动生化分析仪LIS协议接口手册(内含HL7和ASTM)

迈瑞BS系列全自动生化分析仪LIS协议接口手册,内含HL7和ASTM)

ET2012新版免狗免安装绿色软件

ET2012新版免狗免安祖昂绿色软件。,新界面,新视觉,

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

锂电池充电器电路设计 里面有电路

锂电池充电器电路设计 里面有电路 3.7V升压到5V电路设计。

上一篇: 【springcloud 微服务】Spring Cloud Alibaba Sentinel使用详解
下一篇: 【springcloud 微服务】Spring Cloud Alibaba整合Sentinel详解
逆风飞翔的小叔
逆风飞翔的小叔 新星创作者: 大数据技术领域 新星创作者: 大数据技术领域
博客等级 码龄5年 1万+粉丝 215原创
评论 172
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

逆风飞翔的小叔

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值