ideawu / ssdb

SSDB - A fast NoSQL database, an alternative to Redis
http://ssdb.io/
BSD 3-Clause "New" or "Revised" License
8.19k stars 1.41k forks source link

Question: Coreos Cluster Setup #864

Open mindnuts opened 8 years ago

mindnuts commented 8 years ago

Hi i really like SSDB server. I was wondering what is required for creating a cluster (Multi master) on a Cloud OS like CoreOS. How can i setup multiple nodes on different Machines with dynamic IPs. Is it possible to refresh the list of Masters on the runtime? Any help would be appreciated.

Cheers M

mindnuts commented 8 years ago

@ideawu I was able to do the setup of SSDB on CoreOS. However i am facing an issue with the CPU usage. I have created a cluster of 3 machines (using Vagrant) where each machine is a slave of N-1 machines in the cluster. When i start all the machines in the cluster they are able to talk to each other but i am seeing almost 100% CPU usage when i add 2-3 keys. After a point all the nodes become non-responsive and i have to shutdown the VM.

Attaching the relevant conf file

# ssdb-server config
# MUST indent by TAB!

# relative to path of this file, directory must exists
work_dir = /var/lib/ssdb
pidfile = /run/ssdb.pid

server:
    ip: 0.0.0.0
    port: 8888
    # bind to public ip
    #ip: 0.0.0.0
    # format: allow|deny: all|ip_prefix
    # multiple allows or denys is supported
    #deny: all
    #allow: 127.0.0.1
    #allow: 192.168
    # auth password must be at least 32 characters
    #auth: very-strong-password

replication:
    binlog: yes
        capacity: 20000000
    sync_speed: -1

    slaveof:
        type: sync
        host: 172.17.8.102
        port: 8888

    slaveof:
        type: sync
        host: 172.17.8.103
        port: 8888

logger:
    level: warn
    output: stdout
    rotate:
        size: 1000000000

leveldb:
    # in MB
    cache_size: 500
    # in KB
    block_size: 32
    # in MB
    write_buffer_size: 64
    # in MB
    compaction_speed: 1000
    # yes|no
    compression: no

Can you please help me understand why the CPU usage is going up so much for trivial amount of keys.

Edit1: I have checked with both log level Debug and Info there is no error on the console Edit2: I am using Version 1.9.2 Edit3: I have built the images from the Dockerfile provided with this project

Regards M

ideawu commented 8 years ago

From the picture, there is loop around nodes. So you are configuring multi-master architecture, refer to this doc:

http://ssdb.io/docs/replication.html

pay high attention on type: sync and type: mirror

mindnuts commented 8 years ago

@ideawu Thanks for your response. I think then the documentation must make it clear what type of values goes with which setup.

mindnuts commented 8 years ago

@ideawu Thanks with the change from "sync" to "mirror" it is working correctly. May i suggest one final new option to generate a static binary which can be plonked to another system (off course the architecture must match ).

what this would do is we can build containers in two step and the final Docker image can be just "From scratch" and the resulting image would be ~5 Mb