• 企业架构LNMP学习笔记44


    小工具:

    memcached_tool.php软件,可以查看memcached运行状态、key(item)的数量、内存使用量等。

    1)上传memcached_tool.php到web服务器上:

    上传到虚拟机主机可以访问的目录即可。需要php的运行环境:

    本次上传到server01服务器的/usr/local/nginx/html/tp5shop/public下。

    2)修改连接参数:

    vim /usr/local/nginx/html/tp5shop/public/memcached_tool.php

    示例配置:

    登录地址看实际的地址。

    说明:

    uptime:启动时长。

    Hits:命中率。

    Misses:没有命中率。

    创建一个普通用户,然后再用普通用户启动memcached。

    1. [root@server08 bin]# id memcached
    2. uid=1001(memcached) gid=1001(memcached) groups=1001(memcached)
    3. [root@server08 bin]#
    4. [root@server08 bin]#
    5. [root@server08 bin]# ps aux |grep memcached
    6. root 4051 0.0 0.2 414996 4188 ? Ssl 16:22 0:02 ./memcached -uroot -d
    7. root 4195 0.0 0.0 112812 968 pts/0 S+ 20:45 0:00 grep --color=auto memcached
    8. [root@server08 bin]#
    9. [root@server08 bin]#
    10. [root@server08 bin]# kill 4051
    11. [root@server08 bin]# ps aux |grep memcached
    12. root 4197 0.0 0.0 112812 972 pts/0 S+ 20:45 0:00 grep --color=auto memcached
    13. [root@server08 bin]#
    14. [root@server08 bin]#
    15. [root@server08 bin]#
    16. [root@server08 bin]# ./memcached -umemcached -d
    17. [root@server08 bin]#
    18. [root@server08 bin]# ps aux |grep memcached
    19. memcach+ 4199 0.0 0.1 413968 3136 ? Ssl 20:45 0:00 ./memcached -umemcached -d
    20. root 4210 0.0 0.0 112812 972 pts/0 S+ 20:45 0:00 grep --color=auto memcached

     

    有3个items。

    还可以查看到键值对的具体信息:

    这个小工具,可以看着是监控工具,如果命中率降低了,说明业务上哪个地方有问题了,说明数据库服务器的请求增多了。数据库压力上来了,数据库宕机。

    zabbix监控,可以监控memcached。

  • 相关阅读:
    C/C++内存管理(malloc/calloc/realloc/free/new/delete/operator new/operator delete)
    STM32一
    内存访问与栈
    关于技术人员成长的一些建议
    Sigmoid类神经网络的鲁棒性验证
    P4317 花神的数论题
    【体系结构】计算机体系结构知识点清单
    C++零碎记录(五)
    约瑟夫环的代码
    prompt提示词:影响力营销文案,让AI 帮你写营销文案
  • 原文地址:https://blog.csdn.net/chang_chunhua/article/details/132889310