[root@localhost easegress]# easegress-server WARNING: Package "github.com/golang/protobuf/protoc-gen-go/generator" is deprecated. A future release of golang/protobuf will delete this package, which has long been excluded from the compatibility promise.
2021-06-13T09:47:09.205+08:00 INFO server/main.go:61 Easegress release: v1.0.0, repo: megaease/easegress, commit: 3dd74e5b01d0852ed5dffe03de9b4d48a64667e7 2021-06-13T09:47:09.205+08:00 INFO storage/storage.go:250 /root/workspace/easegress/running_objects.yaml not exist 2021-06-13T09:47:09.205+08:00 INFO cluster/cluster.go:186 starting etcd cluster 2021-06-13T09:47:09.205+08:00 INFO cluster/cluster.go:382 client connect with endpoints: [http://localhost:2380] 2021-06-13T09:47:09.205+08:00 INFO cluster/config.go:126 etcd config: init-cluster:eg-default-name=http://localhost:2380 cluster-state:new force-new-cluster:false 2021-06-13T09:47:09.206+08:00 INFO cluster/cluster.go:396 client is ready 2021-06-13T09:47:09.733+08:00 INFO cluster/cluster.go:607 server is ready 2021-06-13T09:47:09.734+08:00 INFO cluster/cluster.go:468 lease is ready 2021-06-13T09:47:09.734+08:00 INFO cluster/cluster.go:204 cluster is ready 2021-06-13T09:47:09.763+08:00 INFO storage/storage.go:250 /root/workspace/easegress/running_objects.yaml not exist 2021-06-13T09:47:09.764+08:00 INFO supervisor/supervisor.go:197 create system controller StatusSyncController 2021-06-13T09:47:09.764+08:00 INFO cluster/cluster.go:513 session is ready 2021-06-13T09:47:09.765+08:00 INFO api/api.go:113 api server running in localhost:2381 2021-06-13T09:47:14.738+08:00 INFO cluster/member.go:233 self ID changed from 0 to 689e371e88f78b6a 2021-06-13T09:47:14.739+08:00 INFO cluster/member.go:154 store clusterMembers: eg-default-name(689e371e88f78b6a)=http://localhost:2380 2021-06-13T09:47:14.739+08:00 INFO cluster/member.go:155 store knownMembers : eg-default-name(689e371e88f78b6a)=http://localhost:2380
fmt.Printf("Server started at port: %d\n", *port) _ = http.ListenAndServe(fmt.Sprintf(":%d", *port), nil) }
可以看到,服务默认监听了9095端口,但是我们可以通过
同时,各个路由的Handler:
/:mirrorHandler;
/pipeline/activity/1:helloHandler;
/pipeline/activity/2:helloHandler;
下面启动服务:
1 2 3 4 5 6 7 8 9 10 11 12
[root@localhost easegress]# go run mirror.go & Server started at port: 9095 [root@localhost easegress]# go run mirror.go -p 9096 & Server started at port: 9096 [root@localhost easegress]# go run mirror.go -p 9097 & Server started at port: 9097
# 查看后台服务 [root@localhost easegress]# jobs [1] Running go run mirror.go & [2]- Running go run mirror.go -p 9096 & [3]+ Running go run mirror.go -p 9097 &
[root@localhost easegress]# curl http://127.0.0.1:10080/pipeline -d 'Hello, Easegress' Your Request server from port 9095 =============== Method: POST URL : /pipeline Header: map[Accept:[*/*] Accept-Encoding:[gzip] Content-Type:[application/x-www-form-urlencoded] User-Agent:[curl/7.29.0]] Body : Hello, Easegress
[root@localhost easegress]# curl http://127.0.0.1:10080/pipeline -d 'Hello, Easegress' Your Request server from port 9096 =============== Method: POST URL : /pipeline Header: map[Accept:[*/*] Accept-Encoding:[gzip] Content-Type:[application/x-www-form-urlencoded] User-Agent:[curl/7.29.0]] Body : Hello, Easegress
[root@localhost easegress]# curl http://127.0.0.1:10080/pipeline -d 'Hello, Easegress' Your Request server from port 9097 =============== Method: POST URL : /pipeline Header: map[Accept:[*/*] Accept-Encoding:[gzip] Content-Type:[application/x-www-form-urlencoded] User-Agent:[curl/7.29.0]] Body : Hello, Easegress
[root@localhost easegress]# curl http://127.0.0.1:10080/pipeline -d 'Hello, Easegress' Your Request server from port 9095 =============== Method: POST URL : /pipeline Header: map[Accept:[*/*] Accept-Encoding:[gzip] Content-Type:[application/x-www-form-urlencoded] User-Agent:[curl/7.29.0]] Body : Hello, Easegress