这篇文章主要介绍“如何配置Nacos服务注册与发现”,在日常操作中,相信很多人在如何配置Nacos服务注册与发现问题上存在疑惑,小编查阅了各式资料,整理出简单好用的操作方法,希望对大家解答”如何配置Nacos服务注册与发现”的疑惑有所帮助!接下来,请跟着小编一起来学习吧!
https://download.csdn.net/download/qq_28336351/14936184
以Mac为例,演示。
进入到 nacos/bin
目录。
启动命令:
sh startup.sh -m standalone
地址:http://localhost:8848/nacos
默认账号:nacos
默认密码:nacos
以Mac为例,演示。
进入到 nacos/bin
目录。
启动命令:
sh shutdown.sh
<!-- nacos 服务注册 --> <dependency> <groupId>com.alibaba.cloud</groupId> <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId> </dependency>
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You 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. */ package com.fengwenyi.demouserservicecore.config; import org.springframework.cloud.client.discovery.EnableDiscoveryClient; import org.springframework.context.annotation.Configuration; /** * @author <a href="mailto:chenxilzx1@gmail.com">theonefx</a> */ @EnableDiscoveryClient @Configuration public class NacosDiscoveryConfiguration { }
spring.cloud.nacos.discovery.server-addr=127.0.0.1:8848 spring.cloud.nacos.discovery.group=springcloud-alibaba-demo
到此,关于“如何配置Nacos服务注册与发现”的学习就结束了,希望能够解决大家的疑惑。理论与实践的搭配能更好的帮助大家学习,快去试试吧!若想继续学习更多相关知识,请继续关注亿速云网站,小编会继续努力为大家带来更多实用的文章!
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。