wuhongshuang 4 éve
commit
705aedd8b7

+ 35 - 0
.gitignore

@@ -0,0 +1,35 @@
+# Created by .ignore support plugin (hsz.mobi)
+
+# Operating System Files
+
+*.DS_Store
+Thumbs.db
+*.sw?
+.#*
+*#
+*~
+*.sublime-*
+
+# Build Artifacts
+
+.gradle/
+build/
+target/
+bin/
+dependency-reduced-pom.xml
+
+# Eclipse Project Files
+
+.classpath
+.project
+.settings/
+
+# IntelliJ IDEA Files
+
+*.iml
+*.ipr
+*.iws
+*.idea
+
+# other code repositories
+.svn

+ 75 - 0
pom.xml

@@ -0,0 +1,75 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+	<modelVersion>4.0.0</modelVersion>
+
+	<groupId>com.shawn</groupId>
+	<artifactId>EurekaServer</artifactId>
+	<version>0.0.1</version>
+	<packaging>jar</packaging>
+
+	<name>EurekaServer</name>
+	<description>spring discover server</description>
+
+	<parent>
+		<groupId>org.springframework.boot</groupId>
+		<artifactId>spring-boot-starter-parent</artifactId>
+		<version>2.0.2.RELEASE</version>
+		<relativePath /> <!-- lookup parent from repository -->
+	</parent>
+
+	<properties>
+		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+		<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
+		<java.version>1.8</java.version>
+		<spring-cloud.version>Finchley.RC2</spring-cloud.version>
+	</properties>
+
+	<dependencies>
+		<dependency>
+			<groupId>org.springframework.cloud</groupId>
+			<artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
+		</dependency>
+
+		<dependency>
+			<groupId>org.springframework.boot</groupId>
+			<artifactId>spring-boot-starter-test</artifactId>
+			<scope>test</scope>
+		</dependency>
+	</dependencies>
+
+	<dependencyManagement>
+		<dependencies>
+			<dependency>
+				<groupId>org.springframework.cloud</groupId>
+				<artifactId>spring-cloud-dependencies</artifactId>
+				<version>${spring-cloud.version}</version>
+				<type>pom</type>
+				<scope>import</scope>
+			</dependency>
+		</dependencies>
+	</dependencyManagement>
+
+	<build>
+		<plugins>
+			<plugin>
+				<groupId>org.springframework.boot</groupId>
+				<artifactId>spring-boot-maven-plugin</artifactId>
+			</plugin>
+		</plugins>
+	</build>
+
+	<repositories>
+		<repository>
+			<id>spring-milestones</id>
+			<name>Spring Milestones</name>
+			<url>https://repo.spring.io/milestone</url>
+			<snapshots>
+				<enabled>false</enabled>
+			</snapshots>
+		</repository>
+	</repositories>
+
+
+</project>

+ 14 - 0
src/main/java/com/shawn/EurekaServerApplication.java

@@ -0,0 +1,14 @@
+package com.shawn;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer;
+
+@SpringBootApplication
+@EnableEurekaServer
+public class EurekaServerApplication {
+
+	public static void main(String[] args) {
+		SpringApplication.run(EurekaServerApplication.class, args);
+	}
+}

+ 29 - 0
src/main/resources/application-eureka1.properties

@@ -0,0 +1,29 @@
+server.port=49014
+# eureka
+spring.application.name=eureka-server
+spring.profiles.active=eureka1
+#主机名
+eureka.instance.hostname=eureka1
+
+eureka.instance.prefer-ip-address=true
+eureka.instance.instance-id=${eureka.instance.hostname}:${server.port}
+#eureka.instance.lease-renewal-interval-in-seconds=5
+#eureka.instance.lease-expiration-duration-in-seconds=5
+#服务注册中心的配置内容,指定服务注册中心的位置
+eureka.client.service-url.defaultZone=http://eureka1:49014/eureka/,http://eureka2:49014/eureka/,http://eureka3:49014/eureka/
+#是否向服务注册中心注册自己
+eureka.client.register-with-eureka=true
+#是否检索服务
+eureka.client.fetch-registry=true
+
+
+#Log levels (TRACE, DEBUG, INFO, WARN, ERROR, FATAL, OFF)
+logging.level.root=INFO
+logging.level.org.springframework=INFO
+logging.level.org.springframework.web=INFO
+logging.level.org.mybatis=DEBUG
+logging.level.com.shawn=TRACE
+# File output
+logging.file.max-size=100MB
+logging.file.max-history=30
+logging.file=/app/applogs/${spring.application.name}/${spring.application.name}.log

+ 29 - 0
src/main/resources/application-eureka2.properties

@@ -0,0 +1,29 @@
+server.port=49014
+# eureka
+spring.application.name=eureka-server
+spring.profiles.active=eureka2
+#主机名
+eureka.instance.hostname=eureka2
+
+eureka.instance.prefer-ip-address=true
+eureka.instance.instance-id=${eureka.instance.hostname}:${server.port}
+#eureka.instance.lease-renewal-interval-in-seconds=5
+#eureka.instance.lease-expiration-duration-in-seconds=5
+#服务注册中心的配置内容,指定服务注册中心的位置
+eureka.client.service-url.defaultZone=http://eureka1:49014/eureka/,http://eureka2:49014/eureka/,http://eureka3:49014/eureka/
+#是否向服务注册中心注册自己
+eureka.client.register-with-eureka=true
+#是否检索服务
+eureka.client.fetch-registry=true
+
+
+#Log levels (TRACE, DEBUG, INFO, WARN, ERROR, FATAL, OFF)
+logging.level.root=INFO
+logging.level.org.springframework=INFO
+logging.level.org.springframework.web=INFO
+logging.level.org.mybatis=DEBUG
+logging.level.com.shawn=TRACE
+# File output
+logging.file.max-size=100MB
+logging.file.max-history=30
+logging.file=/app/applogs/${spring.application.name}/${spring.application.name}.log

+ 29 - 0
src/main/resources/application-eureka3.properties

@@ -0,0 +1,29 @@
+server.port=49014
+# eureka
+spring.application.name=eureka-server
+spring.profiles.active=eureka3
+#主机名
+eureka.instance.hostname=eureka3
+
+eureka.instance.prefer-ip-address=true
+eureka.instance.instance-id=${eureka.instance.hostname}:${server.port}
+#eureka.instance.lease-renewal-interval-in-seconds=5
+#eureka.instance.lease-expiration-duration-in-seconds=5
+#服务注册中心的配置内容,指定服务注册中心的位置
+eureka.client.service-url.defaultZone=http://eureka1:49014/eureka/,http://eureka2:49014/eureka/,http://eureka3:49014/eureka/
+#是否向服务注册中心注册自己
+eureka.client.register-with-eureka=true
+#是否检索服务
+eureka.client.fetch-registry=true
+
+
+#Log levels (TRACE, DEBUG, INFO, WARN, ERROR, FATAL, OFF)
+logging.level.root=INFO
+logging.level.org.springframework=INFO
+logging.level.org.springframework.web=INFO
+logging.level.org.mybatis=DEBUG
+logging.level.com.shawn=TRACE
+# File output
+logging.file.max-size=100MB
+logging.file.max-history=30
+logging.file=/app/applogs/${spring.application.name}/${spring.application.name}.log

+ 29 - 0
src/main/resources/application-eureka4.properties

@@ -0,0 +1,29 @@
+server.port=49014
+# eureka
+spring.application.name=eureka-server
+spring.profiles.active=eureka4
+#主机名
+eureka.instance.hostname=eureka4
+
+eureka.instance.prefer-ip-address=true
+eureka.instance.instance-id=${eureka.instance.hostname}:${server.port}
+#eureka.instance.lease-renewal-interval-in-seconds=5
+#eureka.instance.lease-expiration-duration-in-seconds=5
+#服务注册中心的配置内容,指定服务注册中心的位置
+eureka.client.service-url.defaultZone=http://eureka3:${server.port}/eureka/,http://eureka4:${server.port}/eureka/
+#是否向服务注册中心注册自己
+eureka.client.register-with-eureka=true
+#是否检索服务
+eureka.client.fetch-registry=true
+
+
+#Log levels (TRACE, DEBUG, INFO, WARN, ERROR, FATAL, OFF)
+logging.level.root=INFO
+logging.level.org.springframework=INFO
+logging.level.org.springframework.web=INFO
+logging.level.org.mybatis=DEBUG
+logging.level.com.shawn=TRACE
+# File output
+logging.file.max-size=100MB
+logging.file.max-history=30
+logging.file=/app/applogs/${spring.application.name}/${spring.application.name}.log

+ 29 - 0
src/main/resources/application.properties

@@ -0,0 +1,29 @@
+server.port=49014
+# eureka
+spring.application.name=eureka-server
+spring.profiles.active=eureka3
+#主机名
+eureka.instance.hostname=eureka3
+
+eureka.instance.prefer-ip-address=true
+eureka.instance.instance-id=${eureka.instance.hostname}:${server.port}
+#eureka.instance.lease-renewal-interval-in-seconds=5
+#eureka.instance.lease-expiration-duration-in-seconds=5
+#服务注册中心的配置内容,指定服务注册中心的位置
+eureka.client.service-url.defaultZone=http://eureka1:49014/eureka/,http://eureka2:49014/eureka/,http://eureka3:49014/eureka/
+#是否向服务注册中心注册自己
+eureka.client.register-with-eureka=true
+#是否检索服务
+eureka.client.fetch-registry=true
+
+
+#Log levels (TRACE, DEBUG, INFO, WARN, ERROR, FATAL, OFF)
+logging.level.root=INFO
+logging.level.org.springframework=INFO
+logging.level.org.springframework.web=INFO
+logging.level.org.mybatis=DEBUG
+logging.level.com.shawn=TRACE
+# File output
+logging.file.max-size=100MB
+logging.file.max-history=30
+logging.file=/app/applogs/${spring.application.name}/${spring.application.name}.log

+ 16 - 0
src/test/java/com/shawn/EurekaServerApplicationTests.java

@@ -0,0 +1,16 @@
+package com.shawn;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest
+public class EurekaServerApplicationTests {
+
+	@Test
+	public void contextLoads() {
+	}
+
+}