Getting started with Redis configuration and C ++ in Ubuntu, ubunturedis

Source: Internet
Author: User
Tags benchmark

Getting started with Redis configuration and C ++ in Ubuntu, ubunturedis

RedisIs a high-performance key-value database. The emergence of Redisedis largely compensates for the shortage of key/value storage such as memcached. In some cases, it can complement relational databases. It provides clients such as Java, C/C ++, C #, PHP, JavaScript, Perl, Object-C, Python, Ruby, and Erlang for ease of use.

This article introduces the configuration of Redis in Ubuntu and how to get started with C ++ to help readers get started with Redis quickly.

Install configurations
Obtain, decompress, enter the source code directory, and compile

$ wget http://download.redis.io/releases/redis-2.8.13.tar.gz$ tar xzf redis-2.8.13.tar.gz$ cd redis-2.8.13$ make


Testing and Installation

$ make-test$ sudo make install

After the make command is executed, an executable file is generated under the src directory, including redis-server, redis-cli, redis-benchmark, and redis-stat. Their functions are as follows:

Redis-server: daemon Startup Program of the Redis server
Redis-cli: Redis command line operation tool. Of course, you can also use telnet to operate based on its plain text protocol.
Redis-benchmark: Redis performance testing tool to test the read/write performance of Redis in your system and your configuration
Redis-stat: Redis status detection tool that can detect the current status parameters and latency of Redis.

Run Redis:

$ src/redis-server

You can interact with Redis using the built-in client:

$ src/redis-cliredis> set foo barOKredis> get foo"bar"


C ++ configuration and getting started Configuration

On Ubuntu:

$ apt-get install libhiredis-dev

On OSX run:

$ brew install hiredis

On other platforms:

$ git clone https://github.com/antirez/hiredis.git && cd hiredis && make && sudo make install && sudo ldc

Otherwise, an error may occur due to the lack of hiredis dependency:

error: hiredis/hiredis.h: No such file or directory

Getting started

RedisTest. cpp

#include <stdio.h>#include 


Compile command

g++ redisTest.cpp -o redisTest -I./deps/hiredis/ -L./deps/hiredis/ -lhiredis





Configure the c Programming Environment in ubuntu

Sudo apt-get install build-essential

Build-essential is a C language development kit that contains many tools for gcc make gdb and libc function libraries.

With the help of newbie Daxia, errors occur when c and c ++ development environments are configured in eclipse in ubuntu to create C files,

We recommend that you use Visual Stdio or Visual C ++ to write C/C ++, which we basically use.
The error reported by you may be that it is not configured, or the storage address of the C file does not match the connection. We recommend that you re-select the Location. It should not be too deep and put it in the root directory folder, on the third layer, you can see that you are placed on the fifth layer. debugging is much more troublesome.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.