当前位置: 首页 > news >正文

电子商务网站建设(论文wordpress的登入页面

电子商务网站建设(论文,wordpress的登入页面,做3d地形比较好的网站,dede视频网站源码目录 一、安装redis,配置redis.conf 1.安装gcc 2.将redis的压缩包放到指定位置解压 [如下面放在 /opt 目录下] 3.编译安装 4.配置redis.conf文件 5.开机自启 二、解决虚拟机本地可以连接redis但是主机不能连接redis 1.虚拟机网络适配器网络连接设置为桥接模式…

目录

一、安装redis,配置redis.conf

1.安装gcc

2.将redis的压缩包放到指定位置解压 [如下面放在 /opt 目录下]

3.编译安装

4.配置redis.conf文件

5.开机自启

二、解决虚拟机本地可以连接redis但是主机不能连接redis

1.虚拟机网络适配器网络连接设置为桥接模式

2.控制面板查看主机的网络连接信息

3.手动配置虚拟机网络连接,输入与主机同一网络段地址

三、配置远程连接

1.设置防火墙端口

2.使用windows图形化界面

四、IDEA连接redis

1.新建项目

2.引入redis依赖和连接池依赖

3.配置文件

4.注入redisTemplate

5.编写测试(所以代码)

6.查看winsows GUI 界面


一、安装redis,配置redis.conf

1.安装gcc

# Redis是基于C语言编写的,因此首先需要安装Redis所需要的gcc依赖:
yum install -y gcc tcl
gcc -v # 查看gcc版本

2.将redis的压缩包放到指定位置解压 [如下面放在 /opt 目录下]

# 安装reids
ll # 查看目录内容
cd /opt # 进入 /opt 目录,将redis压缩包放在该目录下
tar xzf redis-7.0.0.tar.gz # 解压
cd redis-7.0.0 # 进入redis文件夹
make && make install # 编译安装redis# 出现以下语句则安装成功
# Hint: It's a good idea to run 'make test' ;)
# - redis-cli:是redis提供的命令行客户端
# - redis-server:是redis的服务端启动脚本
# - redis-sentinel:是redis的哨兵启动脚本redis-server # 启动redis

3.编译安装

4.配置redis.conf文件

# 更改配置 redis.conf
pwd # 查看当前所在路劲信息
mkdir /myredis # 创建一个鑫目录文件夹用来存放副本reids.conf配置文件
cp redis.conf /myredis # 将redis.conf复制到/myredis 文件目录下
vim redis.conf # 编辑redis.conf配置文件# redis.conf 的配置更改,使用 /bind 回车找到位置
# 允许访问的地址,默认是127.0.0.1,会导致只能在本地访问。修改为0.0.0.0则可以在任意IP访问,生产环境不要设置为0.0.0.0
bind 0.0.0.0
# 守护进程,修改为yes后即可后台运行
daemonize yes 
# 密码,设置后访问Redis必须输入密码
requirepass 123456

5.开机自启

# 开机自启 
vi /etc/systemd/system/redis.service
# 内容如下
[Unit]
Description=redis-server
After=network.target[Service]
Type=forking
ExecStart=/usr/local/bin/redis-server /usr/local/src/redis-6.2.6/redis.conf
PrivateTmp=true[Install]
WantedBy=multi-user.target# 然后重载系统服务
systemctl daemon-reload# 启动
systemctl start redis
# 停止
systemctl stop redis
# 重启
systemctl restart redis
# 查看状态
systemctl status redis# 运行命令实现开机自启
systemctl enable redis
# 其他配置(可选)
# 监听的端口
port 6379
# 工作目录,默认是当前目录,也就是运行redis-server时的命令,日志、持久化等文件会保存在这个目录
dir .
# 数据库数量,设置为1,代表只使用1个库,默认有16个库,编号0~15
databases 1
# 设置redis能够使用的最大内存
maxmemory 512mb
# 日志文件,默认为空,不记录日志,可以指定日志文件名
logfile "redis.log"

二、解决虚拟机本地可以连接redis但是主机不能连接redis

(先关闭虚拟机再进行以下配置:)

1.虚拟机网络适配器网络连接设置为桥接模式

2.控制面板查看主机的网络连接信息

3.手动配置虚拟机网络连接,输入与主机同一网络段地址

4.主机与虚拟机网络地址对应

ifconfig # 查看网络地址 192.168.43.180
redis-cli -h 192.168.43.180 -p 6379 -a 123456 # 使用网络地址连接服务器

三、配置远程连接

1.设置防火墙端口

sudo firewall-cmd --add-port=6379/tcp --permanent
sudo firewall-cmd --reload
redis-cli -h c -p 6379 -a 123456
ps aux | grep redis

2.使用windows图形化界面

四、IDEA连接redis

1.新建项目

2.引入redis依赖和连接池依赖

<!--redis依赖-->
<dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
<!--common-pool-->
<dependency><groupId>org.apache.commons</groupId><artifactId>commons-pool2</artifactId>
</dependency>

3.配置文件

spring:redis:host: 192.168.43.180 # 更换成自己的地址port: 6379password: 123456lettuce:pool:max-active: 8max-idle: 8min-idle: 0max-wait: 100ms

4.注入redisTemplate

@Autowired
private RedisTemplate<String, Object> redisTemplate;

5.编写测试(所以代码)

import com.heima.redis.pojo.User;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.data.redis.core.RedisTemplate;@SpringBootTest
class RedisDemoApplicationTests {@Autowiredprivate RedisTemplate<String,Object> redisTemplate;@Testvoid testString() {// 写入一条String数据redisTemplate.opsForValue().set("name", "柯迪耐");// 获取string数据Object name = redisTemplate.opsForValue().get("name");System.out.println("name = " + name);}@Testvoid testSaveUser() {// 写入数据redisTemplate.opsForValue().set("user:100", new User("虎哥", 21));// 获取数据User o = (User) redisTemplate.opsForValue().get("user:100");System.out.println("o = " + o);}
}

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.serializer.GenericJackson2JsonRedisSerializer;
import org.springframework.data.redis.serializer.RedisSerializer;@Configuration
public class RedisConfig {@Beanpublic RedisTemplate<String, Object> redisTemplate(RedisConnectionFactory connectionFactory){// 创建RedisTemplate对象RedisTemplate<String, Object> template = new RedisTemplate<>();// 设置连接工厂template.setConnectionFactory(connectionFactory);// 创建JSON序列化工具GenericJackson2JsonRedisSerializer jsonRedisSerializer = new GenericJackson2JsonRedisSerializer();// 设置Key的序列化template.setKeySerializer(RedisSerializer.string());template.setHashKeySerializer(RedisSerializer.string());// 设置Value的序列化template.setValueSerializer(jsonRedisSerializer);template.setHashValueSerializer(jsonRedisSerializer);// 返回return template;}
}

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;@Data
@NoArgsConstructor
@AllArgsConstructor
public class User {private String name;private Integer age;
}

6.查看winsows GUI 界面

http://www.yayakq.cn/news/836283/

相关文章:

  • 上海市杨浦区建设小学网站沙元埔做网站的公司
  • 南京电商网站开发两学一做网站专栏怎么设置
  • 比较流行的sns营销网站高质量外链购买
  • 专业做高品质的代工网站小程序网站制作公司
  • 系统网站建设ppt一建 专业
  • asp.net制作的网站开发建设银行网站流水账单怎么打
  • 绵阳企业网站建设公司提交谷歌网站
  • 公司做网站一般要多少钱电子商务网站特点
  • php怎么做直播网站开封建设局网站
  • txt做网站如何加图片爱网站网站查询
  • 湖南省网站备案登记网页制作培训班哪个好
  • 网站建设公司中企动力推荐网站建设 宜昌
  • 怎吗做网站挣钱网站通栏图片代码
  • 做网站一定要自己搭建服务器吗自动的网站制作
  • 阿里巴巴网站建设改图片衡水专业做wap网站
  • 301 网站 怎么做苏州正规做网站公司
  • 网站横幅背景图上杭网站设计
  • 做SEO公司多给网站房地产政策最新消息2022
  • 什么网站可以做引文分析深圳wap网站建设公司
  • 泰州市建设局网站网站建设的安全可行性
  • 哪个网站可以做微信引导图环保主题静态网站模板下载
  • 广州金融网站建设淮安网站建设优化
  • 南县做网站江苏两学一做网站
  • 电子商务网站建设技术方案保定住房和城乡建设局网站
  • 如何规避电子政务门户网站建设用手机自创游戏
  • 如室设计网站wordpress模板教程视频
  • 深圳网站建设知名 乐云践新成都建设网站 scgckj
  • 苏州品牌网站设计定制如何在百度上推广自己
  • 小区媒体网站建设微信小程序自助建站
  • 询广西南宁网站运营网络seo排名