'NoSQL/Redis'에 해당되는 글 10건

  1. [펌] redis-caching-server
  2. Redis를 주 데이터 저장소로 사용하기
  3. Redis on Windows – stable and reliable 2.8.4, 2.6.14 설치 가능.ㅋㅋㅋ
  4. redis centos 설치
  5. Redis ndc2013
  6. Redis(Windows OS) 복제 구성하기 1
  7. Redis - Windows 설치하기
  8. (펌) redis use case
  9. (펌) redis 공부하기
  10. redis의 랭킹 처리

[펌] redis-caching-server

'NoSQL > Redis' 카테고리의 다른 글

[펌] redis-caching-server  (0) 2013.07.08
Redis on Windows – stable and reliable 2.8.4, 2.6.14 설치 가능.ㅋㅋㅋ  (0) 2013.05.08
redis centos 설치  (0) 2013.04.30
Redis ndc2013  (0) 2013.04.26
Redis(Windows OS) 복제 구성하기  (1) 2013.03.04


Redis on Windows – stable and reliable


2014.03.28 >> 

http://msopentech.com/blog/2014/03/24/updates-released-redis-windows/

Redis 2.8.4, 2.6.14 버젼을 윈도우 버젼 업데이트 되었습니다. 
https://github.com/msopenTech/redis/tree/2.8.4_msopen 경로의 Download ZIP 버튼을 누르면 소스 및 빌드 파일들을 다운로드 할 수 있습니다.

visual studio 2010의 \redis-2.8.4_msopen\msvs 폴더에 RedisServer.sln 실행 및 빌드가능.
\redis-2.8.4_msopen\bin\release 폴더에는 redis-2.8.4.zip 파일 존재합니다.



MSOpenTech에서도 2.6 버젼 테스트 해보았구먼~
zip 형태로 다운로드 받아서 설치 한다. http://mysqltag.tistory.com/41 여기를 참고해서 설치 한다.


Windows Service 등록해주는 프로그램을 약간 손을 봤음.
소스 다운로드 소스 수정하고, vs2010에서 재컴파일해서 사용중.. Service로 시작 및 중지 잘 되는 구먼.ㅋㅋ

 
        // 서비스 종료시 수정
        static void StopRedis()
        {
            ProcessStartInfo pi = new ProcessStartInfo(Path.Combine(_path, RedisCLI)) { Arguments = (_port == 0 ? "" : String.Format("-p {0} ", _port)) + "SHUTDOWN" };
            pi.FileName = "cmd.exe";
            pi.WorkingDirectory = _path;
            pi.Arguments = @"/C """ + RedisCLI.ToString() + (_port == 0 ? " " : String.Format(" -p {0} ", _port)) + "SHUTDOWN";

            try
            {
                using (Process exeProcess = Process.Start(pi))
                {
                    exeProcess.WaitForExit();
                }
            }
            catch (System.Exception ex)
            {
            	
            }
        }



OS 환경은 윈도우로 보이며, 아키텍쳐 64bit, 메모리 할당자는 libc로 리눅스 베이스는 Jemalloc는 쓰지만, 윈도우 환경을 위해서 libc로 변경한 듯 보인다.

https://raw.github.com/antirez/redis/2.6/00-RELEASENOTES


멀티 쓰레드 환경에서 Memory Allocator
http://www.mimul.com/pebble/default/2011/05/15/1305469792430.html



'NoSQL > Redis' 카테고리의 다른 글

[펌] redis-caching-server  (0) 2013.07.08
Redis를 주 데이터 저장소로 사용하기  (0) 2013.05.14
redis centos 설치  (0) 2013.04.30
Redis ndc2013  (0) 2013.04.26
Redis(Windows OS) 복제 구성하기  (1) 2013.03.04

redis centos 설치

다운로드 후 설치
http://www.redis.io/download ( 2.6.12 )
 
		
#. http://www.redis.io/download

[root@localhost ~]# wget http://redis.googlecode.com/files/redis-2.6.12.tar.gz
[root@localhost ~]# tar xzf redis-2.6.12.tar.gz
[root@localhost ~]# cd redis-2.6.12
[root@localhost redis-2.6.12]# make


mkdir /etc/redis /var/lib/redis

cd src		
cp -f redis-benchmark redis-check-aof redis-check-dump redis-cli redis-sentinel redis-server /var/lib/redis
cd ..
cp -f redis.conf /etc/redis

##. http://www.ebrueggeman.com/blog/install-redis-centos-56
sed -e "s/^daemonize no$/daemonize yes/" -e "s/^dir \.\//dir \/var\/lib\/redis\//" -e "s/^loglevel debug$/loglevel notice/" -e "s/^logfile stdout$/logfile \/var\/log\/redis.log/" redis.conf > /etc/redis/redis.conf

wget https://raw.github.com/gist/257849/9f1e627e0b7dbe68882fa2b7bdb1b2b263522004/redis-server
sed -i "s/usr\/local\/sbin\/redis/usr\/local\/bin\/redis/" redis-server
chmod u+x redis-server
mv redis-server /etc/init.d
/sbin/chkconfig --add redis-server
/sbin/chkconfig --level 345 redis-server on
/sbin/service redis-server start

redis-cli -h 아이피 정보 -p 6379


Redis ndc2013

'NoSQL > Redis' 카테고리의 다른 글

Redis on Windows – stable and reliable 2.8.4, 2.6.14 설치 가능.ㅋㅋㅋ  (0) 2013.05.08
redis centos 설치  (0) 2013.04.30
Redis(Windows OS) 복제 구성하기  (1) 2013.03.04
Redis - Windows 설치하기  (0) 2013.03.04
(펌) redis use case  (0) 2013.02.25


참고 링크

http://misoin.wordpress.com/2012/06/05/redis-%EB%B3%B5%EC%A0%9C-masterslaves/


Redis를 Windows 설치 하기

http://judydba.tistory.com/201



1. 설정 파일 생성

C:\Redis\Config 디렉토리에 redis.conf 파일을 복사하여 redis_master.conf, redis_slave.conf 파일을 생성. 

## Redis_master.conf

Port : 7379

Bind : 아이피주소

logfile D:\DB\Redis\log\master_redis.log

dbfilename D:\DB\Redis\dump_master.rdb


-- Security Sectioin

Requirepass의 주석을 해제. 원하는 비밀번호 생성

##. Redis_slave.conf

Port : 8379

Bind : 아이피주소

logfile D:\DB\Redis\log\redis_slave.log

dbfilename D:\DB\Redis\dump_slave.rdb

-- replication section

slaveof 아이피주소 7379

-- master auth

masterauth foobared

-- 주석 제거

repl-ping-slave-period 10

repl-timeout 60


2. 윈도우 서비스 등록

sc create "REDIS_Master" binpath= "c:\Redis\RedisService.exe C:\Redis\Config\redis_master.conf" start= "auto" DisplayName= "REDIS_Master"


sc create "REDIS_Slave" binpath= "c:\Redis\RedisService.exe C:\Redis\Config\redis_slave.conf" start= "auto" DisplayName= "REDIS_Slave"


3. 로그 확인

## master Server

[6624] 07 Jun 16:58:40 # Windows does not support daemonize. Start Redis as service

[6624] 07 Jun 16:58:40 * Server started, Redis version 2.4.5

[6624] 07 Jun 16:58:40 * DB loaded from disk: 0 seconds

[6624] 07 Jun 16:58:40 * The server is now ready to accept connections on port 7379

[6624] 07 Jun 16:58:45 * Slave ask for synchronization

[6624] 07 Jun 16:58:45 * Starting BGSAVE for SYNC

[6624] 07 Jun 16:58:45 * Foregroud saving started by pid 6624

[6624] 07 Jun 16:58:45 * DB saved on disk

[6624] 07 Jun 16:58:45 * Background saving terminated with success

[6624] 07 Jun 16:58:45 * Synchronization with slave succeeded


## Slave Server

[1044] 07 Jun 16:58:45 * The server is now ready to accept connections on port 8379

[1044] 07 Jun 16:58:45 * Connecting to MASTER...

[1044] 07 Jun 16:58:45 * MASTER <-> SLAVE sync started

[1044] 07 Jun 16:58:45 * Non blocking connect for SYNC fired the event.

[1044] 07 Jun 16:58:45 * MASTER <-> SLAVE sync: receiving 10 bytes from master

[1044] 07 Jun 16:58:45 * MASTER <-> SLAVE sync: Loading DB in memory

[1044] 07 Jun 16:58:45 * MASTER <-> SLAVE sync: Finished with success


4. 연결 및 복제 테스트
## master 서버 연결
--a는 패스워드이다. 복제간 테스트 할때 conf 파일에 설정된 정보

## Slave 서버 연결

복제 테스트 완료!!.

'NoSQL > Redis' 카테고리의 다른 글

redis centos 설치  (0) 2013.04.30
Redis ndc2013  (0) 2013.04.26
Redis - Windows 설치하기  (0) 2013.03.04
(펌) redis use case  (0) 2013.02.25
(펌) redis 공부하기  (0) 2013.02.25

Redis - Windows 설치하기

메모리 DB 전용으로 사용될 Redis 테스트할 기회가 생겨 Redis Windows에 설치하게 되었다. 

Redis windows Version Download

https://github.com/dmajkic/redis/downloads

Redis 연구노트

http://kerocat.tistory.com/1


Redis Windows

https://github.com/kcherenkov/redis-windows-service

http://suretalent.blogspot.kr/2011/11/installing-redis-database-as-windows.html

https://github.com/kcherenkov/redis-windows-service/downloads

http://maxivak.com/getting-started-with-redis-and-asp-net-mvc-under-windows/

 

1. 디렉토리 생성

가."c:\redis\" 폴더에 압축 파일 해제

 

나. Data 폴더 생성

d:\db\Redis\

 

다. Config 폴더 생성

c:\Redis>Config


2. 설정 파일 이동

c:\Redis\Config로 redis.conf 파일을 복사하여 이동 


redis.conf: 수정 내용

#daemonize yes (windows 버전은 지원되지 않는다)

bind 127.0.0.1 (don't do this if you need to access redis from another computer)

loglevel notice

logfile d:\DB\redis\log\redis.log

dir D:\DB\redis\

 

3. 서비스 실행 파일 다운로드

https://github.com/kcherenkov/redis-windows-service/downloads

위의 경로를 통하여 실행 파일을 다운로드 받아 c:\redis\ 폴더에 저장

 

4. 윈도우 서비스 등록

sc create "REDIS001" binpath= "c:\Redis\RedisService_1.exe C:\Redis\Config\redis.conf" start= "auto" DisplayName= "Redis"

Where:

%name% -- name of service instance, ex. redis-instance;

%binpath% -- path to this project exe file, ex. C:\Program Files\redis\RedisService.exe;

%configpath% -- path to redis configuration file, ex. E:\Redis\redis.conf;

 

5. 윈도우 서비스 삭제       

sc delete "REDIS001"


6. 클라이언트 접속 확인

7. 로그파일 확인

[8888] 07 Jun 14:20:18 * Server started, Redis version 2.4.5

[8888] 07 Jun 14:20:18 # Open data file D:\DB\Redis\dump.rdb: No such file or directory

[8888] 07 Jun 14:20:18 * The server is now ready to accept connections on port 6379

[8888] 07 Jun 14:35:19 * 1 changes in 900 seconds. Saving...

[8888] 07 Jun 14:35:19 * Foregroud saving started by pid 8888

[8888] 07 Jun 14:35:19 * DB saved on disk

[8888] 07 Jun 14:35:19 * Background saving terminated with success


'NoSQL > Redis' 카테고리의 다른 글

Redis ndc2013  (0) 2013.04.26
Redis(Windows OS) 복제 구성하기  (1) 2013.03.04
(펌) redis use case  (0) 2013.02.25
(펌) redis 공부하기  (0) 2013.02.25
redis의 랭킹 처리  (0) 2013.02.25

(펌) redis use case

'NoSQL > Redis' 카테고리의 다른 글

Redis ndc2013  (0) 2013.04.26
Redis(Windows OS) 복제 구성하기  (1) 2013.03.04
Redis - Windows 설치하기  (0) 2013.03.04
(펌) redis 공부하기  (0) 2013.02.25
redis의 랭킹 처리  (0) 2013.02.25

(펌) redis 공부하기

'NoSQL > Redis' 카테고리의 다른 글

Redis ndc2013  (0) 2013.04.26
Redis(Windows OS) 복제 구성하기  (1) 2013.03.04
Redis - Windows 설치하기  (0) 2013.03.04
(펌) redis use case  (0) 2013.02.25
redis의 랭킹 처리  (0) 2013.02.25

redis의 랭킹 처리

http://dev.kthcorp.com/2011/07/28/redis-buildingfast-lightweight-webapp/

여기에 잘 정리해 두었네요.

2. 최신 item의 랭킹 관리하기 (게임 / 뉴스 등)

  • 현재 게임의 랭킹 순위를 100등까지 보여주기
  • 현재 user 의 순위가 몇 등인지 보여주기
  • 인기뉴스 페이지 관리하기

와 같은 작업을 Redis를 이용하면 매우 쉽게 관리할 수 있습니다.

유저가 점수를 땄을 때에는

ZADD leaderboard <score> <username>
(leaderboard 가 key 입니다)

와 같이 데이터를 쌓은후,

100등까지의 순위를 보여주려면
ZREVRANGE leaderboard 0 99

특정 user 의 순위를 보여주려면
ZRANK leaderboard <username>

과 같이 쉽게 해결할 수 있습니다.

이 방법은 조금 응용하여 인기 뉴스기사를 보여주는데 등에도 응용될 수 있습니다. 최신 뉴스기사 1000개를 리스트에 유지하면서 (LPUSH + LTRIM 사용) 그 결과를 사용하여 ZADD를 하면서 인기뉴스의 목록을 관리하는데 응용할 수 있는 등 응용 방법은 무궁무진 합니다.

주디왈 >> 내가 테스트 해야할 것은 위와 같은 zrank 명령어를 써서 보여주는거다.. 오호..
http://openmymind.net/Data-Modeling-In-Redis/ 모델링 검토


nosql에서 랭킹 테스트
http://openmymind.net/Paging-And-Ranking-With-Large-Offsets-MongoDB-vs-Redis-vs-Postgresql/


2013.03.04

http://openmymind.net/ 레디스 공부하기 좋은 사이트

'NoSQL > Redis' 카테고리의 다른 글

Redis ndc2013  (0) 2013.04.26
Redis(Windows OS) 복제 구성하기  (1) 2013.03.04
Redis - Windows 설치하기  (0) 2013.03.04
(펌) redis use case  (0) 2013.02.25
(펌) redis 공부하기  (0) 2013.02.25