首页 > 数据库 >编译安装redis

编译安装redis

时间:2023-10-08 09:55:07浏览次数:41  
标签:used apps root redis centos7 编译 memory 安装

#安装依赖包
[root@centos7 ~]#yum -y install gcc jemalloc-devel

#下载源码
[root@centos7 ~]#wget http://download.redis.io/releases/redis-5.0.7.tar.gz
[root@centos7 ~]#tar xvf redis-5.0.7.tar.gz

#编译安装
[root@centos7 ~]#cd redis-5.0.7/
[root@centos7 redis-5.0.7]#make PREFIX=/apps/redis install #指定redis安装目录

#配置变量
[root@centos7 ~]#echo 'PATH=/apps/redis/bin:$PATH' > /etc/profile.d/redis.sh
[root@centos7 ~]#. /etc/profile.d/redis.sh

#目录结构
[root@centos7 ~]#tree /apps/redis/
/apps/redis/
└── bin
   ├── redis-benchmark
   ├── redis-check-aof
   ├── redis-check-rdb
   ├── redis-cli
   ├── redis-sentinel -> redis-server
   └── redis-server
1 directory, 6 files

#准备相关目录和配置文件
[root@centos7 ~]#mkdir /apps/redis/{etc,log,data,run} #创建配置文件、日志、数据等目录
[root@centos7 redis-5.0.7]#cp redis.conf /apps/redis/etc/

#启动redis服务
[root@centos7 ~]#redis-server /apps/redis/etc/redis.conf 
27569:C 16 Feb 2020 21:18:20.412 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
27569:C 16 Feb 2020 21:18:20.412 # Redis version=5.0.7, bits=64, 
commit=00000000, modified=0, pid=27569, just started
27569:C 16 Feb 2020 21:18:20.412 # Configuration loaded
27569:M 16 Feb 2020 21:18:20.413 * Increased maximum number of open files to 
10032 (it was originally set to 1024).

#创建 redis 用户和数据目录
[root@centos7 ~]#useradd -r -s /sbin/nologin redis
#设置目录权限
[root@centos7 ~]#chown -R redis.redis /apps/redis/  

#编辑 redis 服务启动文件
#复制CentOS8安装生成的redis.service文件,进行修改
[root@centos7 ~]#scp 10.0.0.8:/lib/systemd/system/redis.service 
/lib/systemd/system/
[root@centos7 ~]#vim /usr/lib/systemd/system/redis.service
[root@centos7 ~]#cat /usr/lib/systemd/system/redis.service
[Unit]
Description=Redis persistent key-value database
After=network.target
[Service]
ExecStart=/apps/redis/bin/redis-server /apps/redis/etc/redis.conf --supervised
systemd
ExecStop=/bin/kill -s QUIT $MAINPID
Type=notify
User=redis
Group=redis
RuntimeDirectory=redis
RuntimeDirectoryMode=0755
[Install]
WantedBy=multi-user.target

#验证 redis 启动
[root@centos7 ~]#systemctl daemon-reload 
[root@centos7 ~]#systemctl start redis
[root@centos7 ~]#systemctl status redis
● redis.service - Redis persistent key-value database
   Loaded: loaded (/usr/lib/systemd/system/redis.service; enabled; vendor 
preset: disabled)
   Active: active (running) since Sun 2020-02-16 23:08:08 CST; 2s ago
 Process: 1667 ExecStop=/bin/kill -s QUIT $MAINPID (code=exited, 
status=0/SUCCESS)
 Main PID: 1669 (redis-server)
   CGroup: /system.slice/redis.service
           └─1669 /apps/redis/bin/redis-server 127.0.0.1:6379
[root@centos7 ~]#ss -ntl
State     Recv-Q Send-Q     Local Address:Port               Peer Address:Port 
        
LISTEN     0      100             127.0.0.1:25                           *:*   
          
LISTEN     0      511             127.0.0.1:6379                         *:*   
          
LISTEN     0      128                     *:22                           *:*   
          
LISTEN     0      100                 [::1]:25                         [::]:*   
          
LISTEN     0      128                 [::]:22                         [::]:*

#使用客户端连接 redis
[root@centos7 ~]#redis-cli 
127.0.0.1:6379> ping
PONG
127.0.0.1:6379> info
# Server
redis_version:5.0.7
redis_git_sha1:00000000
redis_git_dirty:0
redis_build_id:673d8c0ee1a8872
redis_mode:standalone
os:Linux 3.10.0-1062.el7.x86_64 x86_64
arch_bits:64
multiplexing_api:epoll
atomicvar_api:atomic-builtin
gcc_version:4.8.5
process_id:1669
run_id:5e0420e92e35ad1d740e9431bc655bfd0044a5d1
tcp_port:6379
uptime_in_seconds:140
uptime_in_days:0
hz:10
configured_hz:10
lru_clock:4807524
executable:/apps/redis/bin/redis-server
config_file:/apps/redis/etc/redis.conf
# Clients
connected_clients:1
client_recent_max_input_buffer:2
client_recent_max_output_buffer:0
blocked_clients:0
# Memory
used_memory:575792
used_memory_human:562.30K
used_memory_rss:3506176
used_memory_rss_human:3.34M
used_memory_peak:575792
used_memory_peak_human:562.30K
used_memory_peak_perc:100.18%
used_memory_overhead:562590
used_memory_startup:512896
used_memory_dataset:13202
used_memory_dataset_perc:20.99%
allocator_allocated:1201392
allocator_active:1531904
allocator_resident:8310784
total_system_memory:1019645952
total_system_memory_human:972.41M
used_memory_lua:37888
used_memory_lua_human:37.00K
used_memory_scripts:0
used_memory_scripts_human:0B
number_of_cached_scripts:0
maxmemory:0
maxmemory_human:0B
maxmemory_policy:noeviction
allocator_frag_ratio:1.28
allocator_frag_bytes:330512
allocator_rss_ratio:5.43
allocator_rss_bytes:6778880
rss_overhead_ratio:0.42
rss_overhead_bytes:-4804608
mem_fragmentation_ratio:6.57
mem_fragmentation_bytes:2972384
mem_not_counted_for_evict:0
mem_replication_backlog:0
mem_clients_slaves:0
mem_clients_normal:49694
mem_aof_buffer:0
mem_allocator:jemalloc-5.1.0
active_defrag_running:0
lazyfree_pending_objects:0
# Persistence
loading:0
rdb_changes_since_last_save:0
rdb_bgsave_in_progress:0
rdb_last_save_time:1581865688
rdb_last_bgsave_status:ok
rdb_last_bgsave_time_sec:-1
rdb_current_bgsave_time_sec:-1
rdb_last_cow_size:0
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
aof_last_cow_size:0
# Stats
total_connections_received:1
total_commands_processed:2
instantaneous_ops_per_sec:0
total_net_input_bytes:45
total_net_output_bytes:11475
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
expired_stale_perc:0.00
expired_time_cap_reached_count:0
evicted_keys:0
keyspace_hits:0
keyspace_misses:0
pubsub_channels:0
pubsub_patterns:0
latest_fork_usec:0
migrate_cached_sockets:0
slave_expires_tracked_keys:0
active_defrag_hits:0
active_defrag_misses:0
active_defrag_key_hits:0
active_defrag_key_misses:0
# Replication
role:master
connected_slaves:0
master_replid:f7228f0b6203183004fae8db00568f9f73422dc4
master_replid2:0000000000000000000000000000000000000000
master_repl_offset:0
second_repl_offset:-1
repl_backlog_active:0
repl_backlog_size:1048576
repl_backlog_first_byte_offset:0
repl_backlog_histlen:0
# CPU
used_cpu_sys:0.132821
used_cpu_user:0.124317
used_cpu_sys_children:0.000000
used_cpu_user_children:0.000000
# Cluster
cluster_enabled:0
# Keyspace
127.0.0.1:6379> exit
[root@centos7 ~]#

标签:used,apps,root,redis,centos7,编译,memory,安装
From: https://www.cnblogs.com/tanll/p/17748191.html

相关文章

  • 编写脚本实现tomcat一键安装8.5版本
    #下载包到/root目录[root@tomcat~]#lljdk-8u212-linux-x64.tar.gzapache-tomcat-8.5.82.tar.gz-rw-r--r--1rootroot10610025Aug2717:14apache-tomcat-8.5.82.tar.gz-rw-r--r--1rootroot195013152Aug2717:08jdk-8u212-linux-x64.tar.gz#编写脚本[root@to......
  • wsl中matplotlib安装中文字体
    wsl中matplotlib安装中文字体首先修改matplotlib配置的中文字体使用python定位字体路径importmatplotlibmatplotlib.matplotlib_fname()打开电脑的C:windows/fonts下,查找yahei关键字,将微软雅黑ttf字体拷贝,扔到wsl中显示的路径下的fonts/ttf文件夹里面。删除matplot......
  • Redis数据类型和应用场景
    一、Redis常用的5种数据类型字符串(String):最基本的数据类型,可以存储字符串、整数或浮点数。哈希(Hash):键值对的集合,可以在一个哈希数据结构中存储多个字段和值。列表(List):按照插入顺序存储一组有序的值,可以在列表的两端执行插入、删除和访问操作。集合(Set):无序的唯一值的集合,支持......
  • Python基础环境安装
    环境安装记录,便以后直接一套执行一、准备1.Python下载地址:https://www.python.org/downloads/windows/2.卸载①控制面板寻找Python直接卸载;②查看环境变量path中python的变量,找到对应文件夹,将文件夹删除,后在删除环境变量中有关python的变量;③Win+R运行"regedit"打开注......
  • Centos安装网卡驱动make时报错Kernel header files not in any of the expected locat
      Centos安装I219-LM网卡驱动  https://www.cnblogs.com/marixh/p/16927623.html查询适合我的网卡命令:12[root@192src]#lspci|grepnet00:1f.6Ethernetcontroller:IntelCorporationEthernetConnection(11)I219-LM发现适合我的版本是Int......
  • 下载、安装CAN-EYE植被参数工具
      本文介绍植被指数计算软件CAN-EYE的下载、安装方法。  CAN-EYE软件是由法国国家农业研究院(FrenchNationalInstituteofAgriculturalResearch,INRA)下属的EMMAH实验室(MediterraneanEnvironmentandAgro-hydroSystemModelling)开发的免费软件,用以从鱼眼镜头、普通镜头所......
  • Linux - 安装MySQL
    下载地址:https://downloads.mysql.com/archives/community/安装步骤:mkdirmysqltar-xvfmysql-8.0.26-1.el7.x86_64.rpm-bundle.tar-Cmysqlrpm-ivhmysql-community-common-8.0.26-1.el7.x86_64.rpmrpm-ivhmysql-community-client-plugins-8.0.26-1.el7.x86_64.rp......
  • e-prime3安装
    e-prime2.0版本太老,现在安装尝试3.0。下载链接:https://pan.baidu.com/s/1XJFDqhoArpIwEf0NpKvoIQ提取码:h5xk安装解压安装包后,点击setup.exe开始安装!选择点击Install!选择点击Next!选择点击Next!输入序列号licence.txt之后,继续选择点击Next!把LaunchEstudio前面......
  • CentOS环境:离线安装配置gitlab(适用于内网环境)
    前言:  此篇是为了完结真实的物理隔离环境下、验证yum缓存的文件包安装配置是否成功,对上篇在线安装文章的补充。1.互联网电脑环境准备1.1电脑环境配置信息IP:192.168.31.164OS:CentOSLinuxrelease7.9.2009(Core)1.2清除yum的rpm包缓存数据包清除前的数据记录:[root@bdlab......
  • PostgreSQL备份和恢复(Docker安装)
    目录一.准备备份脚本并拷贝进容器二,在宿主机写定时任务去执行容器内的备份脚本一.准备备份脚本并拷贝进容器vibackup.sh#内容如下#!/bin/bash#PostgreSQLdatabasecredentialsDB_NAME="<要备份的数据库名>"DB_USER="<具有该数据库导出权限的用户>"DB_PASS="<用户密码......