单机eureka-server服务步骤:
1:创建maven项目
2:pom中引入eurka-server
<dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-netflix-eureka-server</artifactId> </dependency>
3:编写配置文件
在resources中创建application.yml文件。
server: port: 10086 # 服务端口 spring: application: name: eurekaserver # eureka的服务名称 eureka: client: service-url: #eureka的地址信息 defaultZone: http://127.0.0.1:10086/eureka #fetch-registry: false #register-with-eureka: false
4:编写主启动类
package com.kaigejava.eurekaserver;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer;
/**
* @author 凯哥Java
* @description
* @company
* @since 2022/10/21 20:49
*/
@SpringBootApplication
@EnableEurekaServer
public class EurekaApplication {
public static void main(String[] args) {
SpringApplication.run(EurekaApplication.class);
}
}5:访问eurka控制台
