1.克隆源码到机器

[root@cx-- ~]# git clone https://github.com/envoyproxy/envoy
Cloning into 'envoy'...
remote: Enumerating objects: , done.
remote: Counting objects: % (/), done.
remote: Compressing objects: % (/), done.
remote: Total (delta ), reused (delta ), pack-reused
Receiving objects: % (/), 35.16 MiB | 601.00 KiB/s, done.
Resolving deltas: % (/), done.
[root@cx-- ~]# ls
anaconda-ks.cfg envoy wordpress-mysql
[root@cx-- ~]# ls envoy/
api ci configs DEPRECATED.md examples include NOTICE PULL_REQUEST_TEMPLATE.md REPO_LAYOUT.md SECURITY_RELEASE_PROCESS.md support VERSION
bazel CODE_OF_CONDUCT.md CONTRIBUTING.md DEVELOPER.md EXTENSION_POLICY.md ISSUE_TEMPLATE.md OWNERS.md README.md restarter source test windows
BUILD CODEOWNERS DCO docs GOVERNANCE.md LICENSE PULL_REQUESTS.md repokitteh.star security STYLE.md tools WORKSPACE
[root@cx-- ~]# cd envoy/examples/redis/
[root@cx-- redis]# ls
docker-compose.yaml Dockerfile-proxy Dockerfile-redis envoy.yaml README.md

2.安装docker-compose

[root@cx-- redis]# curl -L https://github.com/docker/compose/releases/download/1.24.1/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
--:--:-- --:--:-- --:--:--
15.4M 15.4M 1353k :: :: --:--:-- 2355k
[root@cx-- redis]# chmod +x /usr/local/bin/docker-compose
[root@cx-- redis]# docker-compose ps
Name Command State Ports
------------------------------

3.创建redis沙箱

[root@cx-- redis]# docker-compose up -d
Creating network "redis_envoymesh" with the default driver
Building proxy
Step / : FROM envoyproxy/envoy-dev:latest
Trying to pull repository docker.io/envoyproxy/envoy-dev ...
latest: Pulling from docker.io/envoyproxy/envoy-dev
35b42117c431: Already exists
ad9c569a8d98: Already exists
293b44f45162: Already exists
0c175077525d: Already exists
720b18d7211c: Pull complete
7e82cb71a605: Pull complete
8dd5fbb71c59: Pull complete
cd8d5f15933d: Pull complete
e7e9de9472a4: Pull complete
Digest: sha256:5d558d699eeb219f672e771d9ab7d455f0c23ecf8cbe81e2fed2bcc4d16fbe21
Status: Downloaded newer image for docker.io/envoyproxy/envoy-dev:latest
---> 66dad96a6e23
Step / : CMD /usr/local/bin/envoy -c /etc/envoy.yaml -l debug --service-cluster proxy
---> Running in 91d0aa4af229
---> 939322cd01f3
Removing intermediate container 91d0aa4af229
Successfully built 939322cd01f3
WARNING: Image for service proxy was built because it did not already exist. To rebuild this image you must use `docker-compose build` or `docker-compose up --build`.
Building redis
Step / : FROM redis
Trying to pull repository docker.io/library/redis ...
latest: Pulling from docker.io/library/redis
fc7181108d40: Already exists
3e0ac67cad82: Pull complete
6ee495cb7235: Pull complete
9f7206d08b9d: Pull complete
a8354ef8cccb: Pull complete
53afb10d81c2: Pull complete
Digest: sha256:ca2d9251c2818df48c6598e01a5bdeab46040dc7ab236abe075d7c7343465177
Status: Downloaded newer image for docker.io/redis:latest
---> 3c41ce05add9
Successfully built 3c41ce05add9
WARNING: Image for service redis was built because it did not already exist. To rebuild this image you must use `docker-compose build` or `docker-compose up --build`.
Creating redis_proxy_1 ... done
Creating redis_redis_1 ... done
[root@cx-- redis]# docker-compose build
Building proxy
Step / : FROM envoyproxy/envoy-dev:latest
---> 66dad96a6e23
Step / : CMD /usr/local/bin/envoy -c /etc/envoy.yaml -l debug --service-cluster proxy
---> Using cache
---> 939322cd01f3
Successfully built 939322cd01f3
Building redis
Step / : FROM redis
---> 3c41ce05add9
Successfully built 3c41ce05add9 [root@cx-- redis]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
ef3799105b89 redis_redis "docker-entrypoint..." About a minute ago Up About a minute 0.0.0.0:->/tcp redis_redis_1
d851feb8d172 redis_proxy "/docker-entrypoin..." About a minute ago Up About a minute 0.0.0.0:->/tcp, 0.0.0.0:->/tcp, /tcp redis_proxy_1

4.使用redis-cli发出一些Redis命令,并验证它们是否通过envoy路由

//注意端口号
> redis-cli -h localhost -p set foo foo
OK
> redis-cli -h localhost -p set bar bar
OK
> redis-cli -h localhost -p get foo
"foo"
> redis-cli -h localhost -p get bar
"bar"

转到http://localhost:8001/stats?usedonly&filter=redis.egress_redis.command并验证以下统计信息

redis.egress_redis.command.get.total:
redis.egress_redis.command.set.total:

其他链接可查看帮助

[root@cx-- ~]# curl http://localhost:8001/help
admin commands are:
/: Admin home page
/certs: print certs on machine
/clusters: upstream cluster status
/config_dump: dump current Envoy configs (experimental)
/contention: dump current Envoy mutex contention stats (if enabled)
/cpuprofiler: enable/disable the CPU profiler
/healthcheck/fail: cause the server to fail health checks
/healthcheck/ok: cause the server to pass health checks
/heapprofiler: enable/disable the heap profiler
/help: print out list of admin commands
/hot_restart_version: print the hot restart compatibility version
/listeners: print listener info
/logging: query/change logging levels
/memory: print current allocation/heap usage
/quitquitquit: exit the server
/ready: print server state, return if LIVE, otherwise return
/reset_counters: reset all counters to zero
/runtime: print runtime values
/runtime_modify: modify runtime values
/server_info: print server version/status information
/stats: print server stats
/stats/prometheus: print server stats in prometheus format

最新文章

  1. libreoffice转换文件为pdf文件乱码问题解决办法
  2. LinQ的增删改查
  3. Android Activity常用生命周期函数
  4. javascript中的稀疏数组(sparse array)和密集数组
  5. SQLite 入门教程(三)好多约束 Constraints
  6. Android源码下载方法详解
  7. Win7无法访问NAS或Samba服务器解决之道 转
  8. C++_基础_C与C++的区别
  9. ural 1203. Scientific Conference(动态规划)
  10. linux中probe函数中传递的参数来源(上)
  11. ORACLE时间日期格式使用总结(参考网上资料汇总)
  12. Web APP & 弹窗插件
  13. .NET[C#]中NullReferenceException(未将对象引用到实例)是什么问题?如何修复处理?(转)
  14. UITableView加载数据,没有数据,没有网络界面处理
  15. 可变数组(PLSQL)
  16. Volley 结合GSON或FastJson用法
  17. 深度学习领域的Papers
  18. python easy_install 发生Unable to find vcvarsall.bat错误的处理方法
  19. MongoDB + Spark: 完整的大数据解决方案
  20. vscode用yuml画类图

热门文章

  1. TFS中的账号和GIT中的账号
  2. WSGI——python-Web框架基础
  3. [原创] Java 流布局管理器 FlowLayout
  4. 2019hdu第二场
  5. 取对数求阶乘位数——lightoj1045
  6. 源码安装zabbix-oracle
  7. 利用NHibernate与MySQL数据库交互
  8. 2018-06-05(thinking in java)
  9. Python中的动态类
  10. SpringBoot通过maven打包成jar,设定主清单属性。