服務啓動
15:14:57.556 INFO 10 --- [nio-8080-exec-3] c.n.e.registry.AbstractInstanceRegistry : Registered instance FRAMEWORK-GATEWAY/10.10.10.10:framework-gateway with status UP (replication=false)
15:15:00.970 INFO 10 --- [a-EvictionTimer] c.n.e.registry.AbstractInstanceRegistry : Running the evict task with compensationTime 0ms
15:15:05.972 INFO 10 --- [a-EvictionTimer] c.n.e.registry.AbstractInstanceRegistry : Running the evict task with compensationTime 2ms
- Registered instance <server>/<id> with status UP:表示服務實例已註冊到eureka上,狀態爲up。
- replication=false:是否同步請求,false表示微服務發送的註冊請求。
- replication=true:是否同步請求,true表示eureka發送的同步請求。
- Running the evict task with compensationTime 2ms:心跳檢查日誌。
- 2ms:表示比標準心跳檢查時間延時多久,也會用於實例過期時間計算上。這裏是心跳檢查爲5s,兩次行調時間15:15:00.970到15:15:05.972,即比5s延時了2ms。。
服務正常關閉
15:16:01.123 INFO 10 --- [io-8080-exec-11] c.n.e.registry.AbstractInstanceRegistry : Registered instance FRAMEWORK-GATEWAY/10.10.10.10:framework-gateway with status DOWN (replication=false)
15:16:05.973 INFO 10 --- [a-EvictionTimer] c.n.e.registry.AbstractInstanceRegistry : Running the evict task with compensationTime 0ms
15:16:06.234 INFO 10 --- [nio-8080-exec-5] c.n.e.registry.AbstractInstanceRegistry : Cancelled instance FRAMEWORK-GATEWAY/10.10.10.10:framework-gateway (replication=false)
- Registered instance <server>/<id> with status DOWN:表示服務實例標記爲down狀態,即不可用。
- Cancelled instance <server>/<id>:表示服務已從註冊中心上註銷。
服務離線
使用kill -9 pid關閉微服務進程,2分後輸出日誌。
16:18:41.626 INFO 10 --- [a-EvictionTimer] c.n.e.registry.AbstractInstanceRegistry : Evicting 1 items (expired=1, evictionLimit=7)
16:18:41.626 WARN 10 --- [a-EvictionTimer] c.n.e.registry.AbstractInstanceRegistry : DS: Registry: expired lease for FRAMEWORK-GATEWAY/10.10.10.10:framework-gateway
16:18:41.626 INFO 10 --- [a-EvictionTimer] c.n.e.registry.AbstractInstanceRegistry : Cancelled instance FRAMEWORK-GATEWAY/10.10.10.10:framework-gateway (replication=false)
-
Evicting 1 items (expired=1, evictionLimit=6):
-
Evicting:expired和evictionLimit中的較小的值,防止一次註銷過多的實例。
-
expired:過期的實例數量。
-
evictionLimit:表示一次可過期的數量,防止一次全部過期,避免觸發eureka保護機制,值爲(eureka上的總實例數*0.15)取整。這裏eureka中所有服務的實例數總和爲40,計算可得40*0.15=6。
-
-
DS: Registry: expired lease for <server>/<id>:表示爲實例心跳過期取消,同時下線。
16:48:38.689 INFO 11 --- [hresholdUpdater] c.n.e.r.PeerAwareInstanceRegistryImpl : Current renewal threshold is : 68
- Current renewal threshold is : 68:表示eureka每分鐘最低續約次數,低於68次續約則開啓自我保護,不會註銷任何服務,爲總實例數*0.85,這裏爲80*0.85=68.
日誌級別調整
#eureka日誌級別,
logging:
level:
com.netflix: warn #可以減少心跳日誌輸出