Redis主从搭建
redis安装方法见:初识Redis邂逅 安装环境: [root@localhost redis]# redis-server --versionRedis server v=2.8.7 sha=00000000:0 malloc=jemalloc-3.2.0 bits=32 build=df8b796b6fcf0127[root@localhost redis]# cat /proc/versionLinux version 2.6.18-9
redis安装方法见:初识Redis——邂逅
安装环境:[root@localhost redis]# redis-server --version Redis server v=2.8.7 sha=00000000:0 malloc=jemalloc-3.2.0 bits=32 build=df8b796b6fcf0127 [root@localhost redis]# cat /proc/version Linux version 2.6.18-92.el5 (mockbuild@builder16.centos.org) (gcc version 4.1.2 20071124 (Red Hat 4.1.2-42)) #1 SMP Tue Jun 10 18:49:47 EDT 2008
#master配置文件 cp redis.conf redis-master.conf #slave配置文件 cp redis.conf redis-slave.conf #备份配置文件 cp redis.conf redis-bak.conf
#master配置文件 #保证PID文件区分,PID文件主要用于保证守护进程单例运行 pidfile /var/run/redis-master.pid #区分LOG文件 logfile "/data/redis/6379/log/redis.log" #区分持久化文件 dir /data/redis/6379/data #区分端口 port 6379 #slave配置文件 pidfile /var/run/redis-slave.pid logfile "/data/redis/6380/log/redis.log" dir /data/redis/6380/data port 6380 slaveof 127.0.0.1 6379 #如果为yes,slave实例只读,如果为no,slave实例可读可写。默认 slave-read-only yes
redis-server /etc/redis/redis-master.conf redis-server /etc/redis/redis-slave.conf
[root@localhost redis]# cat /data/redis/6379/log/redis.log [24787] 13 Sep 10:39:45.143 * Max number of open files set to 10032 [24787] 13 Sep 10:39:45.145 # Warning: 32 bit instance detected but no memory limit set. Setting 3 GB maxmemory limit with 'noeviction' policy now. _._ _.-``__ ''-._ _.-`` `. `_. ''-._ Redis 2.8.7 (00000000/0) 32 bit .-`` .-```. ```\/ _.,_ ''-._ ( ' , .-` | `, ) Running in stand alone mode |`-._`-...-` __...-.``-._|'` _.-'| Port: 6379 | `-._ `._ / _.-' | PID: 24787 `-._ `-._ `-./ _.-' _.-' |`-._`-._ `-.__.-' _.-'_.-'| | `-._`-._ _.-'_.-' | http://redis.io `-._ `-._`-.__.-'_.-' _.-' |`-._`-._ `-.__.-' _.-'_.-'| | `-._`-._ _.-'_.-' | `-._ `-._`-.__.-'_.-' _.-' `-._ `-.__.-' _.-' `-._ _.-' `-.__.-' [24787] 13 Sep 10:39:45.146 # Server started, Redis version 2.8.7 [24787] 13 Sep 10:39:45.146 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect. [24787] 13 Sep 10:39:45.146 * The server is now ready to accept connections on port 6379 [24787] 13 Sep 10:40:54.342 * DB saved on disk [24787] 13 Sep 10:42:50.581 * Slave asks for synchronization [24787] 13 Sep 10:42:50.581 * Full resync requested by slave. [24787] 13 Sep 10:42:50.581 * Starting BGSAVE for SYNC [24787] 13 Sep 10:42:50.582 * Background saving started by pid 24816 [24816] 13 Sep 10:42:50.586 * DB saved on disk [24816] 13 Sep 10:42:50.587 * RDB: 0 MB of memory used by copy-on-write [24787] 13 Sep 10:42:50.673 * Background saving terminated with success [24787] 13 Sep 10:42:50.673 * Synchronization with slave succeeded [24787] 13 Sep 10:47:04.093 * DB saved on disk
[root@localhost redis]# cat /data/redis/6380/log/redis.log [24813] 13 Sep 10:42:50.578 * Max number of open files set to 10032 [24813] 13 Sep 10:42:50.579 # Warning: 32 bit instance detected but no memory limit set. Setting 3 GB maxmemory limit with 'noeviction' policy now. _._ _.-``__ ''-._ _.-`` `. `_. ''-._ Redis 2.8.7 (00000000/0) 32 bit .-`` .-```. ```\/ _.,_ ''-._ ( ' , .-` | `, ) Running in stand alone mode |`-._`-...-` __...-.``-._|'` _.-'| Port: 6380 | `-._ `._ / _.-' | PID: 24813 `-._ `-._ `-./ _.-' _.-' |`-._`-._ `-.__.-' _.-'_.-'| | `-._`-._ _.-'_.-' | http://redis.io `-._ `-._`-.__.-'_.-' _.-' |`-._`-._ `-.__.-' _.-'_.-'| | `-._`-._ _.-'_.-' | `-._ `-._`-.__.-'_.-' _.-' `-._ `-.__.-' _.-' `-._ _.-' `-.__.-' [24813] 13 Sep 10:42:50.580 # Server started, Redis version 2.8.7 [24813] 13 Sep 10:42:50.580 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect. [24813] 13 Sep 10:42:50.580 * The server is now ready to accept connections on port 6380 [24813] 13 Sep 10:42:50.580 * Connecting to MASTER 127.0.0.1:6379 [24813] 13 Sep 10:42:50.580 * MASTER <-> SLAVE sync started [24813] 13 Sep 10:42:50.580 * Non blocking connect for SYNC fired the event. [24813] 13 Sep 10:42:50.581 * Master replied to PING, replication can continue... [24813] 13 Sep 10:42:50.581 * Partial resynchronization not possible (no cached master) [24813] 13 Sep 10:42:50.583 * Full resync from master: 9ef3d846e366f7643db9e9250b508d64a34c1079:1 [24813] 13 Sep 10:42:50.673 * MASTER <-> SLAVE sync: receiving 31 bytes from master [24813] 13 Sep 10:42:50.673 * MASTER <-> SLAVE sync: Flushing old data [24813] 13 Sep 10:42:50.673 * MASTER <-> SLAVE sync: Loading DB in memory [24813] 13 Sep 10:42:50.674 * MASTER <-> SLAVE sync: Finished with success [24813] 13 Sep 10:47:04.096 * DB saved on disk
[root@localhost redis]# redis-cli 127.0.0.1:6379> set name test OK 127.0.0.1:6379> save OK [root@localhost redis]# redis-cli -p 6380 127.0.0.1:6380> keys * 1) "name"

핫 AI 도구

Undresser.AI Undress
사실적인 누드 사진을 만들기 위한 AI 기반 앱

AI Clothes Remover
사진에서 옷을 제거하는 온라인 AI 도구입니다.

Undress AI Tool
무료로 이미지를 벗다

Clothoff.io
AI 옷 제거제

AI Hentai Generator
AI Hentai를 무료로 생성하십시오.

인기 기사

뜨거운 도구

메모장++7.3.1
사용하기 쉬운 무료 코드 편집기

SublimeText3 중국어 버전
중국어 버전, 사용하기 매우 쉽습니다.

스튜디오 13.0.1 보내기
강력한 PHP 통합 개발 환경

드림위버 CS6
시각적 웹 개발 도구

SublimeText3 Mac 버전
신 수준의 코드 편집 소프트웨어(SublimeText3)

뜨거운 주제











Redis Cluster Mode는 Sharding을 통해 Redis 인스턴스를 여러 서버에 배포하여 확장 성 및 가용성을 향상시킵니다. 시공 단계는 다음과 같습니다. 포트가 다른 홀수 redis 인스턴스를 만듭니다. 3 개의 센티넬 인스턴스를 만들고, Redis 인스턴스 및 장애 조치를 모니터링합니다. Sentinel 구성 파일 구성, Redis 인스턴스 정보 및 장애 조치 설정 모니터링 추가; Redis 인스턴스 구성 파일 구성, 클러스터 모드 활성화 및 클러스터 정보 파일 경로를 지정합니다. 각 redis 인스턴스의 정보를 포함하는 Nodes.conf 파일을 작성합니다. 클러스터를 시작하고 Create 명령을 실행하여 클러스터를 작성하고 복제본 수를 지정하십시오. 클러스터에 로그인하여 클러스터 정보 명령을 실행하여 클러스터 상태를 확인하십시오. 만들다

Phpmyadmin 보안 방어 전략의 핵심은 다음과 같습니다. 1. Phpmyadmin의 최신 버전을 사용하고 정기적으로 PHP 및 MySQL을 업데이트합니다. 2. 액세스 권한을 엄격하게 제어하고, .htaccess 또는 웹 서버 액세스 제어 사용; 3. 강력한 비밀번호와 2 단계 인증을 활성화합니다. 4. 데이터베이스를 정기적으로 백업하십시오. 5. 민감한 정보를 노출하지 않도록 구성 파일을주의 깊게 확인하십시오. 6. WAF (Web Application Firewall) 사용; 7. 보안 감사를 수행하십시오. 이러한 조치는 부적절한 구성, 이전 버전 또는 환경 보안 위험으로 인해 PhpmyAdmin으로 인한 보안 위험을 효과적으로 줄이고 데이터베이스의 보안을 보장 할 수 있습니다.

Redis는 키의 독창성을 보장하기 위해 5 가지 전략을 사용합니다. 1. 네임 스페이스 분리; 2. 해시 데이터 구조; 3. 데이터 구조 설정; 4. 문자열 키의 특수 문자; 5. LUA 스크립트 확인. 특정 전략의 선택은 데이터 구성, 성능 및 확장 성 요구 사항에 따라 다릅니다.

Redis는 해시 테이블을 사용하여 데이터를 저장하고 문자열, 목록, 해시 테이블, 컬렉션 및 주문한 컬렉션과 같은 데이터 구조를 지원합니다. Redis는 Snapshots (RDB)를 통해 데이터를 유지하고 WRITE 전용 (AOF) 메커니즘을 추가합니다. Redis는 마스터 슬레이브 복제를 사용하여 데이터 가용성을 향상시킵니다. Redis는 단일 스레드 이벤트 루프를 사용하여 연결 및 명령을 처리하여 데이터 원자력과 일관성을 보장합니다. Redis는 키의 만료 시간을 설정하고 게으른 삭제 메커니즘을 사용하여 만료 키를 삭제합니다.

Redis 버전 번호를 보려면 다음 세 가지 방법을 사용할 수 있습니다. (1) info 명령을 입력하고 (2) -version 옵션으로 서버를 시작하고 (3) 구성 파일을 봅니다.

Redis에서 모든 키를 보려면 세 가지 방법이 있습니다. 키 명령을 사용하여 지정된 패턴과 일치하는 모든 키를 반환하십시오. 스캔 명령을 사용하여 키를 반복하고 키 세트를 반환하십시오. 정보 명령을 사용하여 총 키 수를 얻으십시오.

Redis 순서 세트 (ZSETS)는 순서가있는 요소를 저장하고 관련 점수별로 정렬하는 데 사용됩니다. ZSET을 사용하는 단계에는 다음이 포함됩니다. 1. ZSET을 만듭니다. 2. 회원 추가; 3. 회원 점수를 얻으십시오. 4. 순위를 얻으십시오. 5. 순위 범위에서 멤버를 받으십시오. 6. 회원 삭제; 7. 요소 수를 얻으십시오. 8. 점수 범위에서 멤버 수를 얻으십시오.

Redis Command Line 도구 (Redis-Cli)를 사용하여 다음 단계를 통해 Redis를 관리하고 작동하십시오. 서버에 연결하고 주소와 포트를 지정하십시오. 명령 이름과 매개 변수를 사용하여 서버에 명령을 보냅니다. 도움말 명령을 사용하여 특정 명령에 대한 도움말 정보를 봅니다. 종금 명령을 사용하여 명령 줄 도구를 종료하십시오.
