Redis

Iš Žinynas.
Jump to navigation Jump to search

Diegimas[keisti]

wget http://download.redis.io/releases/redis-3.2.11.tar.gz
cd deps ; sudo make hiredis jemalloc linenoise lua ; cd ..
sudo make
sudo make install
cd utils ; sudo chmod +x install_server.sh ; sudo ./install_server.sh

Mutimaster replikacija naudojant dynomite[keisti]

Replikuosime du redmine serverius, multi master replication strategija.

  • node1: 10.36.36.9
  • node2: 10.36.36.10
git clone git@github.com:Netflix/dynomite.git
cd dynomite 
./build.sh
make install

Pirmojo konfigas

dyn_o_mite:
    datacenter: dc1
    rack: rack1
    listen: 0.0.0.0:8379
    dyn_listen: 0.0.0.0:8101
    dyn_seeds:
        - 10.36.36.10:8113:rack1:dc2:0
    dyn_seed_provider: simple_provider
    tokens: '0'
    servers:
        - 127.0.0.1:6379:1
    data_store: 0
    stats_listen: 0.0.0.0:33333
    preconnect: true

Antrojo konfigas

dyn_o_mite:
    datacenter: dc2
    rack: rack1
    listen: 0.0.0.0:8379
    dyn_listen: 0.0.0.0:8113
    dyn_seeds:
        - 10.36.36.9:8101:rack1:dc1:0
    dyn_seed_provider: simple_provider
    tokens: '0'
    servers:
        - 127.0.0.1:6379:1
    data_store: 0
    stats_listen: 0.0.0.0:33333
    preconnect: true

Testavimas[keisti]

Is abieju serveriu pasijungiam redis-cli

redis-cli -h 127.0.0.1 -p 8379
set name value

Kitame ziurime

get name

Systemd service unit[keisti]

Sukuriam systemd servisą "/etc/systemd/system/dynomite.service".

[Unit]
Description=Dynomite - Node 1         
After=network.target
[Service]
Type=simple
User=root
Group=root
LimitNOFILE=1024
Restart=on-failure
RestartSec=1
startLimitIntervalSec=60
ExecStart=/usr/local/sbin/dynomite -c /etc/dynomite/dynomite.yaml                 
PermissionsStartOnly=true
[Install]
WantedBy=multi-user.target
systemctl daemon-reload
systemctl enable dynomite
systemctl start dynomite

Multiple data delete[keisti]

 redis-cli KEYS "*keyus*" | xargs redis-cli DEL