0% encontró este documento útil (0 votos)
40 vistas9 páginas

Mac Manually Install Redis or Redis Manually Mac GitHub

Este documento proporciona instrucciones en 16 pasos para instalar Redis de forma manual en una computadora Mac. Los pasos incluyen descargar e instalar Redis desde el código fuente, configurar el archivo de configuración, crear directorios de datos y registro, agregar la ruta de Redis a las variables de entorno y ejecutar el servidor y cliente de Redis.

Cargado por

Ale Pepe
Derechos de autor
© © All Rights Reserved
Nos tomamos en serio los derechos de los contenidos. Si sospechas que se trata de tu contenido, reclámalo aquí.
Formatos disponibles
Descarga como PDF, TXT o lee en línea desde Scribd
0% encontró este documento útil (0 votos)
40 vistas9 páginas

Mac Manually Install Redis or Redis Manually Mac GitHub

Este documento proporciona instrucciones en 16 pasos para instalar Redis de forma manual en una computadora Mac. Los pasos incluyen descargar e instalar Redis desde el código fuente, configurar el archivo de configuración, crear directorios de datos y registro, agregar la ruta de Redis a las variables de entorno y ejecutar el servidor y cliente de Redis.

Cargado por

Ale Pepe
Derechos de autor
© © All Rights Reserved
Nos tomamos en serio los derechos de los contenidos. Si sospechas que se trata de tu contenido, reclámalo aquí.
Formatos disponibles
Descarga como PDF, TXT o lee en línea desde Scribd
Está en la página 1/ 9

3/8/23, 01:43 Mac manually install redis Or Redis manually mac · GitHub

Comparte código, notas y fragmentos al instante.


SofijaErkin / redis_manually_mac.md
Creado hace 2 años
Star

Código Revisiones 1

Mac instala manualmente redis O Redis manualmente mac


redis_manualmente_mac.md

Redis manualmente (mac)


0.Ingrese al directorio de instalación de redis
cd /usr/local/

1.Descarga redis;
sitio web de inicio: https://redis.io/download
sitio web de descarga: https://download.redis.io/releases/
solo usa este comando:
sudo curl -O http://download.redis.io/releases/redis-3.2.8.tar.gz

si desea descargar redis-xyz, use ese comando:


sudo curl -O http://download.redis.io/releases/redis-x.y.z.tar.gz

2.Descomprimir
sudo tar -zxvf redis-x.y.z.tar.gz

3.Otorgar permisos
Asegúrese de que el usuario actual tenga permisos de lectura y escritura para el
https://gist.github.com/SofijaErkin/6fa0d09afb062518794528c5e77a748f 1/9
3/8/23, 01:43 Mac manually install redis Or Redis manually mac · GitHub

directorio descomprimido:
sudo chown marryme redis-3.2.8

4.Crear enlace suave


Después de la descompresión, obtendrá la carpeta redis-3.2.8. el nombre es un poco
largo
y se puede renombrar. La mejor manera es crear un enlace suave en lugar de cambiar el
nombre,
lo que también facilitará la actualización de redis más adelante:
sudo ln -s redis-3.2.8 redis

El casarse conmigo anterior es el usuario en mi computadora, debe modificarlo de


acuerdo
a su nombre de usuario actual.
5. Otorgar permisos de enlace suave
sudo chown -R marryme redis

6. Compilar
cd redis

sudo make

7. Compilar e instalar
sudo make install

8.Crear directorio de archivos ejecutables


sudo mkdir -p /usr/local/redis/bin

9.Otorgar permisos de archivos ejecutables


sudo chown marryme /usr/local/redis/bin

10.Migrar archivos ejecutables


Redis colocará algunos archivos ejecutables en el directorio /redis/src y los moverá
todos los archivos ejecutables en el directorio /redis/src/ a /redis/bin/:
https://gist.github.com/SofijaErkin/6fa0d09afb062518794528c5e77a748f 2/9
3/8/23, 01:43 Mac manually install redis Or Redis manually mac · GitHub

sudo cp -r /usr/local/redis/src/mkreleasehdr.sh
/usr/local/redis/bin/mkreleasehdr.sh

sudo cp -r /usr/local/redis/src/redis-benchmark /usr/local/redis/bin/redis-


benchmark

sudo cp -r /usr/local/redis/src/redis-check-aof /usr/local/redis/bin/redis-


check-aof

sudo cp -r /usr/local/redis/src/redis-check-rdb /usr/local/redis/bin/redis-


check-rdb

sudo cp -r /usr/local/redis/src/redis-cli /usr/local/redis/bin/redis-cli

sudo cp -r /usr/local/redis/src/redis-sentinel /usr/local/redis/bin/redis-


sentinel

sudo cp -r /usr/local/redis/src/redis-server /usr/local/redis/bin/redis-server

sudo cp -r /usr/local/redis/src/redis-trib.rb /usr/local/redis/bin/redis-


trib.rb

11.Archivo de configuración
No se recomienda colocar ningún archivo de configuración del producto bajo el
producto actual. Copie redis.conf a /usr/local/redis/etc :
sudo cp /usr/local/redis/redis.conf /usr/local/redis/etc

Editar redis.conf :
cd /usr/local/etc/

vim redis.conf

Preste atención a los comandos comunes de vim:


1. Pulse la tecla de letra " i " para el modo de edición;
2. Presione la tecla de retorno " esc " + ingrese la letra " :wq ": guardar y salir
Modifique redis.conf con referencia al siguiente contenido:
#Change to guard mode

daemonize=yes

#Set process lock file

pidfile /usr/local/redis/redis.pid

#port

https://gist.github.com/SofijaErkin/6fa0d09afb062518794528c5e77a748f 3/9
3/8/23, 01:43 Mac manually install redis Or Redis manually mac · GitHub

port 6379

#client timeout

timeout 300

#Log Level

loglevel debug

#Log file location

logfile /usr/local/var/log/redis/redis.log

#Set the number of databases. The default database is 0. Ability to use

#the SELECT <dbid> command to specify the database id on the connection

databases 8

##Specify how many update operations within how long and how many times

#the data will be synchronized to the data file. Able to cooperate with

#multiple conditions

#save <seconds> <changes>

#RedisDefault configuration file provides three conditions:

save 900 1

save 300 10

save 60 10000

#Specify whether to compress data when storing to the local database,

#silently think yes. Redis uses LZF compression, assuming that to

#save CPU time.

# Able close the# option, but it will cause the database file to become

# huge

rdbcompression yes

#Specify the name of the local database file

dbfilename dump.rdb

#Specify the local database path

dir /data/db/

#Specify whether to log after each update operation. Redis writes data to

https://gist.github.com/SofijaErkin/6fa0d09afb062518794528c5e77a748f 4/9
3/8/23, 01:43 Mac manually install redis Or Redis manually mac · GitHub

# disk asynchronously by default. Assuming it’s not turned on, maybe

# Will cause data loss for a period of time when the power is off. Since

# redis itself synchronizes data files according to the above save

# conditions to synchronize, so there are

#The data will only exist in memory for a period of time

appendonly no

#Specify the update log conditions, which have 3 optional values in common:

#no: Means to wait for the operating system to synchronize the data cache

#to the disk (fast)

#always: Indicates that fsync() is manually called to write data to disk

#after each update operation (slow, safe)

#everysec: Means to synchronize once per second (compromise. Default value)

appendfsync everysec

12. Directorio de datos y directorio de registro


De acuerdo con la configuración del archivo de configuración, cree un archivo de datos
directorio y un directorio de registro:
sudo mkdir -p /usr/local/var/log/redis

sudo mkdir -p /data/db

Asegúrese de que el usuario actual tenga permisos de lectura y escritura para lo anterior
dos directorios:
sudo chown marryme /usr/local/var/log/redis

sudo chown marryme /data/db

13.Configurar variables globales


Una vez completada la instalación y la configuración, podemos agregar el redis
directorio del archivo de comandos binarios (directorio de instalación/bin) a la ruta PATH:
Si el terminal predeterminado de su sistema es generalmente bash:
(1) Introduzca la terminal
https://gist.github.com/SofijaErkin/6fa0d09afb062518794528c5e77a748f 5/9
3/8/23, 01:43 Mac manually install redis Or Redis manually mac · GitHub

(2) vim ~/.bash_profile


Edite la ruta de redis: export PATH=/usr/local/redis/bin:$PATH y luego guarde
(3) source ~/.bash_profile //Guardar para hacer efectiva la configuración
Usando zsh:
(1) Introduzca la terminal
(2) vim ~/.zshrc
Edite la ruta de redis: export PATH=/usr/local/redis/bin:$PATH y luego guarde
(3) source ~/.zshrc //Guardar para hacer efectiva la configuración
14.Start the server
Start the redis server for the first time, Or start the server every
time the configuration file is modified
sudo /usr/local/redis/bin/redis-server /usr/local/etc/redis.conf

After initializing the configuration file for the first time and
starting the server, the Redis server is usually started like this:
redis-server

or
sudo redis-server

or
15. redis client
Open the redis client:
redis-cli

or
sudo redis-cli

or
cd /usr/local/redis/bin

./redis-cli

https://gist.github.com/SofijaErkin/6fa0d09afb062518794528c5e77a748f 6/9
3/8/23, 01:43 Mac manually install redis Or Redis manually mac · GitHub

Exit the redis client command line:


exit

Close the redis server in the redis client:


redis-cli

shutdown

or
sudo redis-cli

shutdown

or
cd /usr/local/redis

./bin/redis-cil shutdown

16.close the reids server


(1)Forcibly close the server:
sudo -i

ps -ef | grep -i redis

kill -9 PID

(2)Use ctrl+c in the window where the startup command is executed


(3)Close the redis server in the redis client
17.set password
Redis does not provide a password by default, and access control can be turned
on by modifying the configuration file. Edit redis.conf to start authentication.
(1)Change setting
vim /usr/local/etc/redis/conf

(2)Find the following:


#requirepass foobared
requirepass 123456

(3)Modify foobared, or copy a line, modify foobared to what you want, such as
https://gist.github.com/SofijaErkin/6fa0d09afb062518794528c5e77a748f 7/9
3/8/23, 01:43 Mac manually install redis Or Redis manually mac · GitHub

123456 , and save it.Restart the service. The password has been set successfully.
When connecting, you can log in by entering the password you modified.
Pay special attention, after modifying the configuration file, use this to
start the redis server:
/usr/local/redis/bin/redis-server /usr/local/etc/redis.conf

or
sudo /usr/local/redis/bin/redis-server /usr/local/etc/redis.conf

Login to verify whether the password is set successfully:


(1) Start the redis server
redis-server

or
sudo redis-server

(2) Start the redis client


redis-cli

(3) Enter " config get requirepass " to verify


(4) " (error) NOAUTH Authentication required. " appears to verify that
the password is set successfully!
(5) Enter the password: auth 123456 // get ok
(6) Enter " config get requirepass " again to verify, you can see the
password you set, 123456 is the password
1) "requirepass" 2) "123456"
18.Install graphical interface
Install the mac client: redis-desktop-manager
Official website download address (release version): https://redisdesktop.com
The Redis version suitable for macOS 1x.x ranges from 3.2.x to 4.0.x, or even the lastest
version.
Other reference:
https://gist.github.com/SofijaErkin/6fa0d09afb062518794528c5e77a748f 8/9
3/8/23, 01:43 Mac manually install redis Or Redis manually mac · GitHub

1.homebrew-core/Formula/redis.rb
("Persistent key-value database, with built-in net interface")
https://github.com/Homebrew/homebrew-core/blob/master/Formula/redis.rb
2.homebrew-core/Formula/[email protected]:
("Persistent key-value database, with built-in net interface")
https://github.com/Homebrew/homebrew-core/blob/master/Formula/[email protected]
3.homebrew-core/Formula/[email protected]:
("Persistent key-value database, with built-in net interface")
https://github.com/Homebrew/homebrew-core/blob/master/Formula/[email protected]
4.homebrew-core/Formula/[email protected]:
("Persistent key-value database, with built-in net interface")
https://github.com/Homebrew/homebrew-core/blob/master/Formula/[email protected]
5.homebrew-core/Formula/redis-leveldb.rb:
("Redis-protocol compatible frontend to leveldb")
6.homebrew-core/Formula/hiredis.rb
("Minimalistic client for Redis")
https://github.com/Homebrew/homebrew-core/blob/master/Formula/hiredis.rb

https://gist.github.com/SofijaErkin/6fa0d09afb062518794528c5e77a748f 9/9

También podría gustarte