从0到1搭建redis6.0.7续更~
“心有所向,日复一日,必有精进”
前言:
想必大家看完我之前写的搭建redis服务器,大家都已经把redis搭建起来了吧如果没有搭建起来的小可爱请移步这里哦从0到1搭建redis6
是不是还没看够呢,现在它来了,搭建完redis服务器,我们肯定要去用的,下面我们会一步步讲解redis cluster向PHP客户端扩展。
七、redis cluster 向客户端扩展
1.安装PHP7版本及php-fpm,php-redis,hiredis,swoole扩展
更新yum源
[root@mysql_master ~]# rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
[root@mysql_master ~]# rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
[root@mysql_master /]# yum search php71w
- 注:没有错误的话这里可以跳过
- 安装到这里的时候,发现了我的centos7在装完上面的两个yum源后,进行下一步查看有没有PHP71w扩展的时候,yum search php71w竟然弹出来错误,而且我的yum安装程序也不能使用(不能使用yum install **)
- 搜了很多参考资料,但对这个错误解释的很少,以下是我的解决过程

看错误提示,应该是证书有问题,但这时候我们使用不了yum安装任何东西,所以我们首先删除刚才安装的所有rpm软件包,命令如下:
# yum -y remove epel-release-7-14.noarch
安装证书:
#yum install ca-certificates -y
更新证书:
# update-ca-trust extract
重新更新yum源
[root@mysql_master /]# rpm -ivh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
[root@mysql_master /]# rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
查看PHP信息:
[root@mysql_master /]# yum search php71w #出现以下内容则证明没有问题
mod_php71w.x86_64 : PHP module for the Apache HTTP Server
php71w-bcmath.x86_64 : A module for PHP applications for using the bcmath library
php71w-cli.x86_64 : Command-line interface for PHP
php71w-common.x86_64 : Common files for PHP
php71w-dba.x86_64 : A database abstraction layer module for PHP applications
php71w-devel.x86_64 : Files needed for building PHP extensions
...................内容很多,不再赘述~
2.安装PHP7.1以及扩展
[root@mysql_master /]# yum -y install php71w php71w-fpm php71w-cli php71w-common php71w-devel php71w-gd php71w-pdo php71w-mysql php71w-mbstring php71w-bcmath
3.检查PHP版本
[root@mysql_master /]# php -v
PHP 7.1.33 (cli) (built: Oct 26 2019 10:16:23) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies
4.安装swoole扩展
[root@mysql_master ~]# wget -O Swoole-4.4.5.tar.gz https://github.com/swoole/swoole-src/archive/v4.4.5.tar.gz
[root@mysql_master ~]# tar -zxvf Swoole-4.4.5.tar.gz
[root@mysql_master ~]# cd swoole-src-4.4.5
[root@mysql_master swoole-src-4.4.5]# phpize //(ubuntu没有安装phpize可执行命令: sudo apt-get install php-dev来安装phpize)
[root@mysql_master swoole-src-4.4.5]# ./configure // 配置
[root@mysql_master swoole-src-4.4.5]# make //编译
[root@mysql_master swoole-src-4.4.5]# make install //安装
5.安装PHP-redis扩展
[root@mysql_master ~]# yum -y install redis php-redis
6.安装异步hiredis
[root@mysql_master ~]# yum -y install hiredis-devel
7.配置php.ini
编译安装成功后,修改php.ini加入
[root@mysql_master ~]# vim /etc/php.ini
extension=redis.so
extension=swoole.so
#通过php -m或phpinfo()来查看是否成功加载了swoole.so,如果没有可能是php.ini的路径不对,可以使用php --ini来定位到php.ini的绝对路径
[root@mysql_master ~]# php -m //检查框架模块加载成功没有
8.安装php-fpm扩展
1、安装php71w-fpm 上面已经用yum安装过了就不必再次安装
2、创建web用户组及用户
默认用户www-data
[root@mysql_master ~]# id www-data
id: www-data: no such user
[root@mysql_master ~]# groupadd www-data
[root@mysql_master ~]# useradd -g www-data www-data
[root@mysql_master ~]# id www-data
uid=1001(www-data) gid=1001(www-data) groups=1001(www-data)
9.修改php-fpm
[root@mysql_master ~]# vim /etc/php-fpm.d/www.conf
user=www-data
group=www-data
10.修改Nginx配置
[root@mysql_master ~]# yum -y install nginx
[root@mysql_master ~]# rm -rf /etc/nginx/nginx.conf
[root@mysql_master ~]# cp /etc/nginx/nginx.conf.default /etc/nginx/nginx.conf
[root@mysql_master ~]# vim /etc/nginx/nginx.conf
修改为以下内容
location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
11.写测试页面
[root@mysql_master ~]# systemctl restart nginx
[root@mysql_master ~]# cd /usr/share/nginx/html/
[root@mysql_master html]# vim index.php
#写以下内容
<?php
phpinfo();
?>
#重启服务
[root@mysql_master html]# systemctl restart nginx php-fpm
12.验证PHP是否能正常启动成功
#浏览器访问:
http://192.168.232.11/index.php //这里写自己的配PHP的主机和PHP名称
#往下找看看能否找到redis模块,出现如下信息即配置成功
13.测试
连接哪个redis,应该先开启,否则出现访问拒绝
[root@mysql_master html]# vim redis.php
<?php
//连接192.168.232.12的Redis服务
$redis = new Redis();
$redis->connect('192.168.232.11',7000);
$redis->auth (''); //redis认证
echo "connection to server sucessfully";
//查看服务是否运行
echo "server is running: " . $redis->ping();
?>
好了,到这里我们PHP客户端的redis已搭建起来,想要了解更多redis内容,可以关注私信我,有问题也可以私信我,redis我还会继续更新,感觉写的不错的话点个赞吧~
喜欢就点个关注叭~
转载请注明出处,持续更新ing...
如有问题可以发我邮箱2325117110@qq.com
从0到1搭建redis6.0.7续更~的更多相关文章
- 从0到1搭建redis6.0.7
redis集群搭建 一.安装redis 源码安装: 1.下载源码包: wget http://download.redis.io/releases/redis-6.0.7.tar.gz 2.解压到指定 ...
- Docker:docker搭建redis6.0.8集群
下载redis镜像 #拉取镜像 docker pull redis:6.0.8 查看版本 #查看版本 docker inspect redis 生成redis.conf配置文件 #在 /home/re ...
- centos8平台安装redis6.0.1
一,redis的官网: https://redis.io/ redis6于5月3日正式发布,它的新增功能: acl 多线程io cluster proxy resp3协议 本文演示redis6.0.1 ...
- Redis6.0.6集群服务搭建
实现目标 一台主机上搭建3主3从高可用redis集群 环境 Linux :CentOS7 Redis : 6.0.6 准备工作 1.查看是否有安装wget命令,如果没有安装使用yum命令安装wgt命令 ...
- Redis6.0.9主从搭建
所谓主从,大家都知道主是写数据,而从是进行数据的拷贝. 1:配置 主节点 127.0.0.1 6379 从节点 127.0.0.1 6378 先将单机版的配置文件赋值两份出来,原先的配置中主要改动有: ...
- linux安装redis-6.0.1单机和集群
redis作为一个直接操作内存的key-value存储系统,也是一个支持数据持久化的Nosql数据库,具有非常快速的读写速度,可用于数据缓存.消息队列等. 一.单机版安装 1.下载redis 进入re ...
- centos8平台redis cluster集群搭建(redis5.0.7)
一,规划 redis cluster 1,cluster采用六台redis,3主3从 redis1 : ip: 172.17.0.2 redis2 : ip: 172.17.0.3 red ...
- sorl6.0+jetty+mysql搭建solr服务
1.下载solr 官网:http://lucene.apache.org/solr/ 2.目录结构如下 3.启动solr(默认使用jetty部署) 在path路径下将 bin文件夹对应的目录加入,然后 ...
- 从0到1搭建移动App功能自动化测试平台(2):操作iOS应用的控件
转自:http://debugtalk.com/post/build-app-automated-test-platform-from-0-to-1-Appium-interrogate-iOS-UI ...
随机推荐
- 2.窗口部件-对话框QDialog
1.模态和非模态 看代码 widget.cpp #include "widget.h" #include "ui_widget.h" #include<Q ...
- 如何使用Postman调试HMS Core推送接口?
HMS Core推送服务支持开发者使用HTTPS协议接入Push服务端.Postman是一款接口测试工具,它可以模拟用户发起的各类HTTP请求,将请求数据发送至服务端,获取对应的响应结果.Postma ...
- UTL_FILE 包使用介绍
Postgresql 不支持 package功能,这给oracle 向 postgresql迁移增加了很多迁移工作.人大金仓Kingbase数据库实现了类似 oracle package 功能,并提供 ...
- Taurus.MVC-Java 版本打包上传到Maven中央仓库(详细过程):4、Maven项目转换与pom.xml配置
文章目录: Taurus.MVC-Java 版本打包上传到Maven中央仓库(详细过程):1.JIRA账号注册 Taurus.MVC-Java 版本打包上传到Maven中央仓库(详细过程):2.PGP ...
- python 基于aiohttp的异步爬虫实战
钢铁知识库,一个学习python爬虫.数据分析的知识库.人生苦短,快用python. 之前我们使用requests库爬取某个站点的时候,每发出一个请求,程序必须等待网站返回响应才能接着运行,而在整个爬 ...
- 我的Vue之旅、01 深入Flexbox布局完全指南
花了几个小时整合的"A Complete Guide to Flexbox"最新版本,介绍了flexbox的所有属性,外带几个实用的例子. 传统布局.Flexbox 布局的传统解决 ...
- kubernetes 调度器
调度器 kube-scheduler 是 kubernetes 的核心组件之一,主要负责整个集群资源的调度功能,根据特定的调度算法和策略,将 Pod 调度到最优的工作节点上面去,从而更加合理.更加充分 ...
- suse 安装mysql5.7
1.上传包到home目录下 2.安装 1,解压下载的文件: tar -xvf mysql-5.7.29-1.sles12.x86_64.rpm-bundle.tar 解压后: 3.安装libatomi ...
- Linux Subsystem For Android 11!适用于Debian GNU/Linux的Android子系统,完美兼容ARM安卓软件!
本文将讲述如何在Debian Stable 系统安装一个Android 11子系统,并且这个子系统带有Houdini可以兼容专为移动设备开发的ARM软件.在root权限下,编辑/etc/apt/sou ...
- [题解] BZOJ 3456 洛谷 P4841 [集训队作业2013]城市规划 多项式,分治FFT
题目 令\(f_i\)表示n个点的答案.考虑容斥,用所有连边方案减去有多个连通块的方案.枚举1号点所在的连通块大小: \(f_i=2^{i(i-1)/2}-\sum_{j>0}^{i-1}f_j ...