1.Eureka Introduction; Eureka is produced Netflix tool for implementing service registration and discovery. Spring Cloud integrates Eureka, and provides support out of the box. Which, Eureka Eureka Server and can be subdivided into Eureka Client. 1, Eureka is developed by Netflix service discovery framework, Spring Cloud provides support it, integrate it in their spring-cloud-netflix subproject. 2, Netflix company on Github a lot of open source projects, Eureka is just one, Netflix Open Source Home: HTTPS: //github.com/Netflix 3, Netflix Eureka GitHub open source address: https: //github.com/Netflix/eureka. AWS Service registry for resilient mid-tier load balancing and failover. (Eureka is a service registry AWS elastic intermediate layer load balancing and failover) . 4, it is based on the Eureka REST (Representational state transition layer) service, the main for AWS (Amazon web Services- Amazon web service) cloud location services for load balancing and failover server of the intermediate layer. . 5, of The Build The requires java8 Because some of Libraries that are required java8 (SERVO), but the source and target compatibility are still set to 1.7. ( Eureka building project requires Java JDK 1.8 or later, because some of them have to use the library Java8) 6, Netflix Eureka official document: https: //github.com/Netflix/eureka/wiki, the latest version is January 2019 11 updates the V1.9.9. 7, Netflix Eureka official website of the original version 2.X, the latter for some reason stopped the 2.X version of maintenance, but 1.X version is still active, still under active development, maintenance, and use;
2.Eureka basic characteristics; . (1) generates the basic information object services InstanceInfo when the service starts, and then when it starts to register the service management center. (2) After the registration is complete will pull all the service information from the service management center, cached locally. (3) After the service is 30s (configurable) send a heartbeat message, the service contract. (4) If the service control center does not receive a service contract in the 90s, will think service has been hung up, the service registration information will be deleted. (5) before the service is stopped, stop the service sends an unsolicited request, information service management center will delete this service. (6) If the Eureka Server heartbeat packets received less than the normal value of 85% (configurable) goes into self-protection mode. In this mode, Eureka Server service does not remove any information.
3.Eureka principle
Official website address: https://github.com/Netflix/eureka/wiki/Eureka-at-a-glance
4.eureka linux platform service management to develop the script content; ! # / Bin / bash # configuration information CURDIR = $ (cd $ (dirname $ {BASH_SOURCE [0]}); pwd) #### remote script, automatically obtain the current script path ######## CD $ the CURDIR appName = Eureka Host eureka1-dev.com = Port = 8000 managementPort = $ {Port} appPath = "/ CHJ / App / Eureka /" Cluster = HTTP: // eureka2- dev.com:8000/eureka,http://eureka3-dev.com:8000/eureka Zone Cluster} = $ { JAR = "Eureka-k8s.jar" Memory 512M = ########### ############################################### # service configuration information logdir = "/ CHJ / Data / log / appName {} $" mkdir -p $ {logdir} Source file information ./script/fn.sh environment variables # ### # function information function fnstart () { nohup ${CMD} >> ${logDir}/console.log 2>&1 & processId=$! echo ${processId} > ${appPath}/pid echo "启动完毕" echo "pid 为 ${processId}" } function fnstop() { pidfile="/chj/app/eureka/pid" processId=$(cat ${pidfile}) echo "开始停止服务, pid 为 : ${processId}" kill ${processId} true > ${pidfile} echo "停止完毕" } function fnrestart() { fnstop fnstart return True } function fstatus(){ process=$(cat ${appPath}/pid) if [[ -s ${appPath}/pid ]] then echo "True" else echo "flase" fi } ################################## case $1 in start) fnstart ;; stop) fnstop ;; restart) fnrestart ;; install) fninstall ;; status) fstatus esac cat ./script/fn.sh #!/bin/bash JAVA_OPS="-server -d64 -Xmx${memory} -Xms${memory} -verbose:gc" JAVA_OPS="${JAVA_OPS} -XX:+PrintGCDateStamps -XX:+PrintGCTimeStamps" JAVA_OPS="${JAVA_OPS} -XX:+PrintGCDetails -XX:+PrintTenuringDistribution -XX:+PrintCommandLineFlags -XX:+DisableExplicitGC" JAVA_OPS="${JAVA_OPS} -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+CMSParallelRemarkEnabled -Xloggc:${logDir}/gc.log" JAVA_OPS="${JAVA_OPS} -Djava.security.egd=file:/dev/./urandom" JAVA_OPS="${JAVA_OPS} -DappName=${appName}" CMD="java ${JAVA_OPS} -Dhost=${host} -Dport=${port} -Dcluster=${cluster} -Dzone=${zone} -jar ${jar} --spring.profiles.active=peer"
Directory structure is as follows
The packages will be retrieved address:
https://download.csdn.net/download/u011127348/10628971