Home Database Mysql Tutorial Twemproxy代理Key-Value数据库SSDB实现数据分布式存储

Twemproxy代理Key-Value数据库SSDB实现数据分布式存储

Jun 07, 2016 pm 04:08 PM
Fragmentation

SSDB是一个高性能的支持丰富数据结构的NoSQL数据库,用于替代Redis或者与Redis配合存储十亿级别列表的数据,现在已被许多知名企业所应用。我们使用SSDB是想将现有

    SSDB是一个高性能的支持丰富数据结构的 NoSQL 数据库, 用于替代 Redis或者与 Redis 配合存储十亿级别列表的数据,现在已被许多知名企业所应用。我们使用SSDB是想将现有的redis中的key迁移到SSDB以破除现有的redis 120G存储极限(当然可以扩展,但是计算了下成本就打算放弃了)。

    Twemproxy是twtter开源的一个redis和memcache代理服务器,这里我们使用Twemproxy代理来代理SSDB集群来实现数据的分布式存储,即shared。

    

    1、节点规划:

        Twemproxy        192.168.0.100    

        ssdb1 master     192.168.0.101

        ssdb1 slave      192.168.0.102

        ssdb2 master     192.168.0.103

        ssdb2 slave      192.168.0.104

    2、安装SSDB

## 解压下载好的ssdb软件包 $ unzip  ssdb-master.zip ## 安装gcc、gcc-c++ 、make等工具 ##编译、安装ssdb,会安装在/usr/local/ssdb/下面 $ cd ssdb-master $ make &&make install ## 进入安装目录 $ cd/usr/local/ssdb/ ## 启动ssdb-server $ ./ssdb-server -dssdb.conf ssdb 1.8.2 Copyright (c)2012-2014 ssdb.io ## 验证是否启动成功,若8888端口被监听,则表示成功 $ netstat-alnut|grep 8888 tcp       0      0 127.0.0.1:8888              0.0.0.0:*                   LISTEN ## 客户端连接 $ ./ssdb-cli -p8888  ssdb (cli) - ssdb command line tool. Copyright (c)2012-2014 ssdb.io 'h' or 'help' forhelp, 'q' to quit. server version:1.8.2 ssdb 127.0.0.1:8888>

    3、主从配置,以ssdb1为例

## 修改ssdb1 master的配置文件,如下 # ssdb-server config # MUST indent by TAB!   # relative to path of this file, directorymust exists work_dir = ./var pidfile = ./var/ssdb.pid   server:        ip:192.168.0.101        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        # Limit sync speed to *MB/s, -1: no limit        sync_speed: -1        slaveof:                 # to identify a master even ifit moved(ip, port changed)                 # if set to empty or notdefined, ip:port will be used.                 #id: svc_2                 # sync|mirror, default is sync                 #type: sync                 #ip: 127.0.0.1                 #port: 8889   logger:        level: debug        output: log.txt        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: yes ## 修改ssdb1 slave的配置文件,如下 # ssdb-server config # MUST indent by TAB!   # relative to path of this file, directorymust exists work_dir = ./var pidfile = ./var/ssdb.pid   server:         ip: 192.168.0.102         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        # Limit sync speed to *MB/s, -1: no limit        sync_speed: -1        slaveof:                 # to identify a master even if itmoved(ip, port changed)                 # if set to empty or notdefined, ip:port will be used.                 id: svc_1                 # sync|mirror, default is sync                 type:sync                 ip: 192.168.0.101                 port:8888   logger:        level: debug        output: log.txt        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: yes

   

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

When might a full table scan be faster than using an index in MySQL? When might a full table scan be faster than using an index in MySQL? Apr 09, 2025 am 12:05 AM

Full table scanning may be faster in MySQL than using indexes. Specific cases include: 1) the data volume is small; 2) when the query returns a large amount of data; 3) when the index column is not highly selective; 4) when the complex query. By analyzing query plans, optimizing indexes, avoiding over-index and regularly maintaining tables, you can make the best choices in practical applications.

Explain InnoDB Full-Text Search capabilities. Explain InnoDB Full-Text Search capabilities. Apr 02, 2025 pm 06:09 PM

InnoDB's full-text search capabilities are very powerful, which can significantly improve database query efficiency and ability to process large amounts of text data. 1) InnoDB implements full-text search through inverted indexing, supporting basic and advanced search queries. 2) Use MATCH and AGAINST keywords to search, support Boolean mode and phrase search. 3) Optimization methods include using word segmentation technology, periodic rebuilding of indexes and adjusting cache size to improve performance and accuracy.

Can I install mysql on Windows 7 Can I install mysql on Windows 7 Apr 08, 2025 pm 03:21 PM

Yes, MySQL can be installed on Windows 7, and although Microsoft has stopped supporting Windows 7, MySQL is still compatible with it. However, the following points should be noted during the installation process: Download the MySQL installer for Windows. Select the appropriate version of MySQL (community or enterprise). Select the appropriate installation directory and character set during the installation process. Set the root user password and keep it properly. Connect to the database for testing. Note the compatibility and security issues on Windows 7, and it is recommended to upgrade to a supported operating system.

Difference between clustered index and non-clustered index (secondary index) in InnoDB. Difference between clustered index and non-clustered index (secondary index) in InnoDB. Apr 02, 2025 pm 06:25 PM

The difference between clustered index and non-clustered index is: 1. Clustered index stores data rows in the index structure, which is suitable for querying by primary key and range. 2. The non-clustered index stores index key values ​​and pointers to data rows, and is suitable for non-primary key column queries.

What are some popular MySQL GUI tools (e.g., MySQL Workbench, phpMyAdmin)? What are some popular MySQL GUI tools (e.g., MySQL Workbench, phpMyAdmin)? Mar 21, 2025 pm 06:28 PM

Article discusses popular MySQL GUI tools like MySQL Workbench and phpMyAdmin, comparing their features and suitability for beginners and advanced users.[159 characters]

How do you handle large datasets in MySQL? How do you handle large datasets in MySQL? Mar 21, 2025 pm 12:15 PM

Article discusses strategies for handling large datasets in MySQL, including partitioning, sharding, indexing, and query optimization.

MySQL: Simple Concepts for Easy Learning MySQL: Simple Concepts for Easy Learning Apr 10, 2025 am 09:29 AM

MySQL is an open source relational database management system. 1) Create database and tables: Use the CREATEDATABASE and CREATETABLE commands. 2) Basic operations: INSERT, UPDATE, DELETE and SELECT. 3) Advanced operations: JOIN, subquery and transaction processing. 4) Debugging skills: Check syntax, data type and permissions. 5) Optimization suggestions: Use indexes, avoid SELECT* and use transactions.

Explain different types of MySQL indexes (B-Tree, Hash, Full-text, Spatial). Explain different types of MySQL indexes (B-Tree, Hash, Full-text, Spatial). Apr 02, 2025 pm 07:05 PM

MySQL supports four index types: B-Tree, Hash, Full-text, and Spatial. 1.B-Tree index is suitable for equal value search, range query and sorting. 2. Hash index is suitable for equal value searches, but does not support range query and sorting. 3. Full-text index is used for full-text search and is suitable for processing large amounts of text data. 4. Spatial index is used for geospatial data query and is suitable for GIS applications.

See all articles