首页 > 数据库 >Linux系统之使用yum安装Redis数据库

Linux系统之使用yum安装Redis数据库

时间:2023-04-14 13:35:22浏览次数:31  
标签:kB 00 x86 Redis redis yum Linux 64 el7

(Linux系统之使用yum安装Redis数据库)

一、redis介绍

1.redis解释

Redis(Remote Dictionary Server ),即远程字典服务,是一个开源的使用ANSI C语言编写、支持网络、可基于内存亦可持久化的日志型、Key-Value数据库,并提供多种语言的API。

2.redis特点

1.性能极高 – Redis能读的速度是110000次/s,写的速度是81000次/s 。 2.丰富的数据类型

3.redis使用场景

1.缓存——热数据
2.分布式锁与单线程机制
3.队列
4.排行榜

二、检查系统版本

1.检查系统版本

[root@server ~]# cat /etc/os-release 
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"

CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"

2.检查内核版本

[root@server ~]# uname -r 
3.10.0-957.21.3.el7.x86_64

三、检查yum仓库状态

检查yum仓库是否配置,可以使用阿里的仓库源配置。

[root@server ~]# yum repolist all |grep  enable
Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast
!appnode/x86_64                      AppNode's RPM repository fo enabled:  4,266
!appnode-agent/x86_64                AppNode Agent Repository -  enabled:    332
!appnode-ccenter/x86_64              AppNode CCenter Repository  enabled:     71
!appnode-extras/x86_64               AppNode Extras Repository - enabled:     88
!base/7/x86_64                       CentOS-7 - Base - mirrors.a enabled: 10,072
!docker-ce-stable/7/x86_64           Docker CE Stable - x86_64   enabled:    169
!epel/x86_64                         Extra Packages for Enterpri enabled: 13,735
!extras/7/x86_64                     CentOS-7 - Extras - mirrors enabled:    515
!updates/7/x86_64                    CentOS-7 - Updates - mirror enabled:  4,300


四、查看系统默认提供的redis版本

[root@server ~]# yum info redis
Loaded plugins: fastestmirror
Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
Available Packages
Name        : redis
Arch        : x86_64
Version     : 3.2.12
Release     : 2.el7
Size        : 544 k
Repo        : epel/x86_64
Summary     : A persistent key-value database
URL         : http://redis.io
License     : BSD
Description : Redis is an advanced key-value store. It is often referred to as a data
            : structure server since keys can contain strings, hashes, lists, sets and
            : sorted sets.
            : 
            : You can run atomic operations on these types, like appending to a string;
            : incrementing the value in a hash; pushing to a list; computing set
            : intersection, union and difference; or getting the member with highest
            : ranking in a sorted set.
            : 
            : In order to achieve its outstanding performance, Redis works with an
            : in-memory dataset. Depending on your use case, you can persist it either
            : by dumping the dataset to disk every once in a while, or by appending
            : each command to a log.
            : 
            : Redis also supports trivial-to-setup master-slave replication, with very
            : fast non-blocking first synchronization, auto-reconnection on net split
            : and so forth.
            : 
            : Other features include Transactions, Pub/Sub, Lua scripting, Keys with a
            : limited time-to-live, and configuration settings to make Redis behave like
            : a cache.
            : 
            : You can use Redis from most programming languages also.

五、安装redis

1.安装redis

开始安装redis。

[root@server ~]# yum install -y redis
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
appnode                                                                                                                     | 3.0 kB  00:00:00     
appnode-agent                                                                                                               | 2.9 kB  00:00:00     
appnode-ccenter                                                                                                             | 2.9 kB  00:00:00     
appnode-extras                                                                                                              | 2.9 kB  00:00:00     
base                                                                                                                        | 3.6 kB  00:00:00     
docker-ce-stable                                                                                                            | 3.5 kB  00:00:00     
epel                                                                                                                        | 4.7 kB  00:00:00     
extras                                                                                                                      | 2.9 kB  00:00:00     
updates                                                                                                                     | 2.9 kB  00:00:00     
(1/5): epel/x86_64/group_gz                                                                                                 |  98 kB  00:00:00     
(2/5): epel/x86_64/updateinfo                                                                                               | 1.0 MB  00:00:00     
(3/5): docker-ce-stable/7/x86_64/primary_db                                                                                 |  87 kB  00:00:00     
(4/5): updates/7/x86_64/primary_db                                                                                          |  17 MB  00:00:01     
(5/5): epel/x86_64/primary_db                                                                                               | 7.0 MB  00:00:01     
Resolving Dependencies
--> Running transaction check
---> Package redis.x86_64 0:3.2.12-2.el7 will be installed
--> Processing Dependency: libjemalloc.so.1()(64bit) for package: redis-3.2.12-2.el7.x86_64
--> Running transaction check
---> Package jemalloc.x86_64 0:3.6.0-1.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

===================================================================================================================================================
 Package                           Arch                            Version                                  Repository                        Size
===================================================================================================================================================
Installing:
 redis                             x86_64                          3.2.12-2.el7                             epel                             544 k
Installing for dependencies:
 jemalloc                          x86_64                          3.6.0-1.el7                              appnode                          107 k

Transaction Summary
===================================================================================================================================================
Install  1 Package (+1 Dependent package)

Total download size: 651 k
Installed size: 1.7 M
Downloading packages:
(1/2): redis-3.2.12-2.el7.x86_64.rpm                                                                                        | 544 kB  00:00:00     
(2/2): jemalloc-3.6.0-1.el7.x86_64.rpm                                                                                      | 107 kB  00:00:00     
---------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                              2.3 MB/s | 651 kB  00:00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : jemalloc-3.6.0-1.el7.x86_64                                                                                                     1/2 
  Installing : redis-3.2.12-2.el7.x86_64                                                                                                       2/2 
  Verifying  : redis-3.2.12-2.el7.x86_64                                                                                                       1/2 
  Verifying  : jemalloc-3.6.0-1.el7.x86_64                                                                                                     2/2 

Installed:
  redis.x86_64 0:3.2.12-2.el7                                                                                                                      

Dependency Installed:
  jemalloc.x86_64 0:3.6.0-1.el7                                                                                                                    

Complete!

2.启动redis服务

[root@server ~]# systemctl enable --now redis
Created symlink from /etc/systemd/system/multi-user.target.wants/redis.service to /usr/lib/systemd/system/redis.service.

六、连接redis

测试本地连接redis,查看redis数据库详细信息。

[root@server ~]# redis-cli
127.0.0.1:6379> info
# Server
redis_version:3.2.12
redis_git_sha1:00000000
redis_git_dirty:0
redis_build_id:7897e7d0e13773f
redis_mode:standalone
os:Linux 3.10.0-957.el7.x86_64 x86_64
arch_bits:64
multiplexing_api:epoll
gcc_version:4.8.5
process_id:17174
run_id:0db6caf4f1e1f630fded8256fcf2d032fc9e0ad7
tcp_port:6379
uptime_in_seconds:21
uptime_in_days:0
hz:10
lru_clock:6804044
executable:/usr/bin/redis-server
config_file:/etc/redis.conf

# Clients
connected_clients:1
client_longest_output_list:0
client_biggest_input_buf:0
blocked_clients:0

# Memory
used_memory:813448
used_memory_human:794.38K
used_memory_rss:2523136
used_memory_rss_human:2.41M
used_memory_peak:813448
used_memory_peak_human:794.38K
total_system_memory:7968645120
total_system_memory_human:7.42G
used_memory_lua:37888
used_memory_lua_human:37.00K
maxmemory:0
maxmemory_human:0B
maxmemory_policy:noeviction
mem_fragmentation_ratio:3.10
mem_allocator:jemalloc-3.6.0

# Persistence
loading:0
rdb_changes_since_last_save:0
rdb_bgsave_in_progress:0
rdb_last_save_time:1667748407
rdb_last_bgsave_status:ok
rdb_last_bgsave_time_sec:-1
rdb_current_bgsave_time_sec:-1
aof_enabled:0
aof_rewrite_in_progress:0
aof_rewrite_scheduled:0
aof_last_rewrite_time_sec:-1
aof_current_rewrite_time_sec:-1
aof_last_bgrewrite_status:ok
aof_last_write_status:ok

# Stats
total_connections_received:1
total_commands_processed:1
instantaneous_ops_per_sec:0
total_net_input_bytes:31
total_net_output_bytes:9928
instantaneous_input_kbps:0.00
instantaneous_output_kbps:0.00
rejected_connections:0
sync_full:0
sync_partial_ok:0
sync_partial_err:0
expired_keys:0
evicted_keys:0
keyspace_hits:0
keyspace_misses:0
pubsub_channels:0
pubsub_patterns:0
latest_fork_usec:0
migrate_cached_sockets:0

# Replication
role:master
connected_slaves:0
master_repl_offset:0
repl_backlog_active:0
repl_backlog_size:1048576
repl_backlog_first_byte_offset:0
repl_backlog_histlen:0

# CPU
used_cpu_sys:0.04
used_cpu_user:0.01
used_cpu_sys_children:0.00
used_cpu_user_children:0.00

# Cluster
cluster_enabled:0

# Keyspace

标签:kB,00,x86,Redis,redis,yum,Linux,64,el7
From: https://blog.51cto.com/u_14664141/6189913

相关文章

  • 基于imx8m plus开发板全体系开发教程4:Linux系统开发
    前言:i.MX8MPlus开发板是一款拥有4个Cortex-A53核心,运行频率1.8GHz;1个Cortex-M7核心,运行频率800MHz;此外还集成了一个2.3TOPS的NPU,大大加速机器学习推理。全文所使用的开发平台均为与NXP官方合作的FS-IMX8MPCA开发板(华清远见imx8mp开发板),支持Weston、ubuntu20.04、A......
  • [Linux]回环设备的作用是什么?
    在计算机网络中,回环设备(loopbackdevice)是指一种虚拟网络接口,通常装备在操作系统中,用于向系统本身发送网络数据包,而不需要使用物理网络接口。它可以使应用程序像使用网络接口一样访问本地主机,这样可以方便的测试、开发和调试应用程序,确保应用程序的可靠性和正确性。回环设备的作......
  • [Linux]字符设备、块设备、网络设备、虚拟设备
    在Linux系统中,设备可以分为以下几种类型:1.字符设备字符设备是一种流设备,它以字符为单位进行传输和处理,例如串口、终端和声卡等。它的主要特点是按照顺序访问数据,不支持随机访问和任意长度的读写操作。2.块设备块设备是以块为单位进行读写的设备,例如硬盘、闪存器和CD-ROM......
  • [Linux]流式传输和块传输
    在计算机中,流和块(Block)是用于数据传输和处理的两种不同的处理方式,两者之间的主要区别如下:1.数据单位不同流是一系列按顺序排列的数据字符组成的序列,数据以字节为单位进行传输和处理,适用于逐个传递字符流的应用程序。相比之下,块以块为单位进行传输和处理,每个块包含多个字节,可以......
  • Linux_ubuntu_How to resize Launcher in Unity 2D
    via: http://www.dedoimedo.com/computers/ubuntu-unity-2d-resize-launcher.html ChangeUnity2DconfigurationfilesTheconfigurationfilesarelocatedunder /usr/share/unity-2d/shell.Youwillneedsudotoeditthefilescontainedtherein.Youshouldalsocr......
  • VMWare Horizon Linux 手动场 cannot open display 错误
    环境:系统:rhel7.9horizonagent版本:2209桌面:Gnome问题描述:防火墙已关闭的情况下,在使用LSF交互式任务时不能打开带界面的程序(xhost+已经事先执行过)。解决问题:vim/usr/lib/vmware/viewagent/bin/StartXServer.sh找到xdmcp_opt="-query127.0.0.1-once"改为xdmcp_opt......
  • Linux之find
    find.-name"*.java"下面是该命令所找到的命令的缩略清单:find.-name"*.java"./REGEXPvalidate/src/oracle/otnsamples/plsql/ConnectionManager.java./REGEXPvalidate/src/oracle/otnsamples/plsql/DBManager.java总结find.-typef-maxdepth1-mmin-10-name......
  • centos7.3挂载本地ISO镜像为yum源
    centos7.3挂载本地ISO镜像为yum源应用环境:内网环境安装服务需要相关依赖。上传镜像将镜像文件复制到服务器的root目录/root/CentOS-7-x86_64-DVD-1611.iso新建更新源文件cd/etc/yum.repos.d/cat>local_iso.repo<<EOF[localiso]name=centos_localbaseurl=file:///mnt/......
  • linux_Ubuntu常用快捷键
    =====桌面=====ALT+F1:聚焦到桌面左侧任务导航栏,可按上下键导航。ALT+F2:运行命令ALT+F4:关闭窗口ALT+TAB:切换程序窗口ALT+空格:打开窗口菜单PRINT:桌面截图 SUPER:打开Dash面板,可搜索或浏览项目,默认有个搜索框,按“下”方向键进入浏览区域(SUPER键指Win键或苹......
  • Linux_压缩解压详解
    linuxzip命令 zip-rmyfile.zip./*将当前目录下的所有文件和文件夹全部压缩成myfile.zip文件,-r表示递归压缩子目录下所有文件. 2.unzipunzip-o-d/home/sunnymyfile.zip把myfile.zip文件解压到/home/sunny/-o:不提示的情况下覆盖文件;-d:-d/home/sunny指明将文件解压缩到......