一、使用redis模板监控redis
1.官方share商城下载Redis模板
2.下载配置文件到本地
[root@web01 /etc/zabbix/zabbix_agent2.d]# cat redis.conf
UserParameter=redis.status[*],redis-cli -h $1 -p $2 info|grep $3|grep -v _human|cut -d : -f2
UserParameter=redis.proc,pidof redis-server | wc -l
3.应用本身提供监控页面
1.导入模板(查看KEY的名称)检查模板兼容性
2.测试取值脚本,定义zabbix-agent的配置文件,定义key与模板相对应
3.zabbix_get取值测试
4.链接模板
5.添加宏(类似变量,使模板应用更加灵活)
4.最新数据展示
二、使用redis加速php项目(discuz论坛)
1.搭建discuz服务
第一步:安装nginx+php+mariadb
#安装nginx
yum -y install nginx
vim /etc/nginx/nginx.conf
#安装php
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
yum install nginx php72w-fpm php72w-gd php72w-mbstring php72w-bcmath php72w-xml php72w-ldap php72w-mysqlnd -y
vim /etc/php-fpm.d/www.conf
#安装数据库
Yum -y install mariadb-server
Mysql>create database discuz;
Mysql>grant all on discuz.* to discuz@’10.0.0.8’identified by ‘123456’;
第二步:上传discuz安装包
rz discuz.tar.gz
tar xf discuz.tar.gz -C /html
chown -R nginx:nginx /html
systemctl start mariadb
systemctl start nginx
systemctl start php-fpm
第三步:访问http://10.0.0.7/
2.下载安装redis
yum -y install redis
Systemctl start redis
yum -y install php-pecl-redis.x86-64 #插件来支持redis
systemctl restart php-fpm
vim /html/config/config_global.php
3.测试redis加速效果
三、使用matomo统计分析(PV UV IP)
1.部署matomo服务
官网:Matomo Analytics - The Google Analytics alternative that protects your data
###前提搭建LNMP环境
rz matomo.4.1.0.tar.gz
tar xf matomo.4.1.0.tar.gz -C /html
rm -rf matomo-latest.zip
rm -rf How\ to\ install\ Matomo.html
rm -rf vendor/bin/lessc
访问:http://10.0.0.8/
2.复制JavaScript跟踪代码到discuz
在安装过程中复制
<!-- Matomo -->
<script type="text/javascript">
var _paq = window._paq = window._paq || [];
/* tracker methods like "setCustomDimension" should be called before "trackPageView" */
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function() {
var u="//10.0.0.8/";
_paq.push(['setTrackerUrl', u+'matomo.php']);
_paq.push(['setSiteId', '1']);
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
g.type='text/javascript'; g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
})();
</script>
<!-- End Matomo Code -->