您好,登錄后才能下訂單哦!
這篇文章主要介紹“如何配置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進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。