'공부하고(?)/Linux'에 해당되는 글 22건

우분투에서 제공하는 mongodb를 사용하지 말고,아래 가이드를 보고, mongodb-10gen을 설치해서 사용하자. 


http://docs.mongodb.org/manual/tutorial/install-mongodb-on-ubuntu/


설치방법은 위 사이트에도 나오고 있지만, 귀찮을수도 있으니 아래와 같이 따라하자.


1. 이미 apt-get으로 mongodb를 설치한 상태라면, 지우자 깔끔하게.

$ sudo apt-get remove mongodb 

$ sudo apt-get autoremove


2. mongodb-10gen을 가지고 올수 있게, source list를 수정한다.

$ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10

$ echo 'deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen' | sudo tee /etc/apt/sources.list.d/10gen.list

$ sudo apt-get update

$ sudo apt-get install mongodb-10gen


3. mongodb를 서비스 시작,종료,재시작하는 방법을 알아두고 각각 사용하기

시작

$ sudo service mongodb start 


종료

$ sudo service mongodb stop 


재시작

$ sudo service mongodb restart


끝~~


참고: mongodb는 기본적으로 27017포트를 사용하고, 관리용 페이지는 28017포트를 사용하고 있다.




블로그 이미지

커뉴

이 세상에서 꿈 이상으로 확실한 것을, 인간은 가지고 있는 것일까?

,

프로시환경에서 npm을 사용하려고하면 곧 좌절에 빠지게 된다..


npm이 http를 사용해서 패키지들을 다운로드 받는 방식이기 때문에 프록시 환경이라면... http응답이 없거나, https 터널링에 실패하게 된다.


그래서 git으로 node를 받아서, 컴파일한후 express를 회사에서 한번 받아볼려고 했더니,,, 역시나 좌절!!!


아래와 같이 손쉽게 프록시 셋팅을 끝내버리고 npm을 사용하자.



$ sudo npm config set proxy  [proxyip:port]

$ sudo npm config set registry "http://registry.npmjs.org/"



끝....!!!



블로그 이미지

커뉴

이 세상에서 꿈 이상으로 확실한 것을, 인간은 가지고 있는 것일까?

,

어제 기분좋게 집에서 git을 사용하여 node를 설치하고 이것 저것 셋팅해뒀는데,


회사 개발용 리눅스 데스크탑에도 설치할까 하고 똑같은 방법으로 했더니 아무것도 되지 않았다!!!!


그 원인은 바로 무시 무시한 회사 방화벽 환경 및 proxy때문인데....


그래서 아래와 같이 또 한번 더 작업을 했다.


git을 proxy환경에서 사용하려면 아주 간단한 방법으로 corkscrew라는 프로그램을 설치하여 사용하면 된다.


우선  git은 깔려있겠지만, git을  설치하는 것부터 시작하면 다음과 같은 순서를 따라 하면 된다.


GIT 설치

$ sudo apt-get install git-core


PROXY 설정하기, git config를 사용해도 되지만 ,gitconfig 파일을 직접 수정하기

$ vi ~/.gitconfig 

[core]

    gitproxy = "/home/[userhome]/git-proxy.sh"


corkscrew 설치하기 

$ sudo apt-get  install corkscrew


git-proxy.sh 파일 만들기

$ vi /home/[userhome]/git-proxy.sh

#!/bin/bash

/usr/bin/corkscrew proxyIP proxyPort $1 $2 


git-proxy.sh에 실행권한 주기

$ chmod u+x git-proxy.sh 


이제 git을 사용하면 된다. 

블로그 이미지

커뉴

이 세상에서 꿈 이상으로 확실한 것을, 인간은 가지고 있는 것일까?

,

개발일을 하면서 여러명이 같이 일을 하다보니, 소스 변경이 너무 많고, 왜 이런 수정사항이 생겼는지 관리조차 되지 않을때가 있다.

개인적인 프로젝트를 진행하더라도, 자기가 그날 그날 수정한 코드들이 왜 수정되었는지 관리가 필요할 경우 우리가 생각해볼수 있는것은 여러가지 있겠지만, 그중에서도 가장 편한 방법은 쓰기 쉬운 형상관리 툴을 사용하는 것이다.


그동안 SourceSafe,SVN,CVS,GIT,ClearCase등을 다 써봤지만, Perforce만큼빠르고 쓰기 쉬운 툴은 아직 못본것 같다.


그런던차에 Perforce 를 개인적인 프로젝트를 위해서 사용할수 있는 방법이 없는지 하고 해당 사이트를 들어가보니, 20명의 유저와 20개의 워크스페이스로 무제한으로 사용가능한 Free 버전이 있었다. 바로 다운 받아서 설치했다. 아~~쾌적하다...



1. 일단 perforce 설치를 위해서 perforce 사용자를 추가하자. 앞으로 perforce의 모든 로그, 기록, 명령들은 perforce라는 사용자에 의해서 관리된다.




2. 그리고 나서 Perforce 서버는 기본적으로 daemon이라는 것이 있어야 돌아간다. 설치하자.



3. 이제는 perforce 서버데몬(p4d)와 command line tool(p4)를 다운받고...

http://www.perforce.com/downloads/complete_list




4.실행권한 줘서 복사하자..




5.저장소와 로그디렉토리를 만들고..(저장소에 모든 소스들이 저장된다)


 

6. 이젠 뭐 사용자들이 p4 잘쓸수 있게 profile에 추가해주고..(친절하니까...) 저기 보면 P4PORT가 있는데 나중에 IP가 바뀌면 저거도 같이 바꿔줘야 한다..





7. perforce를 init script에 포함시켜서 부팅시마다 알아서 시작되게 해두자..(역시 저기에 나오는 P4PORT값은 나중에 IP가 바뀌면 !!! 꼭!!!!! 바꿔줘야 p4d가 뜬다)




8. 실행해보면~~~




이제 형상관리 서버를 만들었으니,  cocos2dx를 안드로이드로 포팅하는 작업에 형상관리를 시작해야 겠다.

끝~

블로그 이미지

커뉴

이 세상에서 꿈 이상으로 확실한 것을, 인간은 가지고 있는 것일까?

,

한 10년전쯤인가, 그때는 PHP + MySQL등등으로 RDB전성시대였었던것 같은데(물론 지금은 어떤지 알수 없다..) 최근에는 여기 저기서 NoSQL DB를 많이 사용하고 있는것 같다. 대용량 데이터를 처리하고 다뤄야 하는 데이터 싱크 용도로는 Cassandra 같은 분산 DB가 단연 최고이다.


오늘은 그래서 Cassandra를 한번 설치해봤다. Cassandra가 뭐고, 어떻게 동작하는 것인지는 설치부터 해놓고 이것 저것 만들어가면서 설명해도 모지라지 않으니 일단은 설치부터 해보자.




설치 및 실행 방법


1. 설치하는 방법

1. 다운로드 받기 (http://cassandra.apache.org/download/)

cassandra@ubuntu:~$ wget http://apache.mirror.cdnetworks.com/cassandra/1.1.6/apache-cassandra-1.1.6-bin.tar.gz


2. 압축풀기

cassandra@ubuntu:~$ tar xvfz apache-cassandra-1.1.6-bin.tar.gz

cassandra@ubuntu:~$ mkdir bin

cassandra@ubuntu:~$ mv apache-cassandra-1.1.6 ./bin

cassandra@ubuntu:~$ cd bin

cassandra@ubuntu:~/bin$ ln -s apache-cassandra-1.1.6 cassandra


3. 로그 설정이라던지, 각종 설정 변경하기는 아래 두개의 파일을 수정하면 됨.

cassandra@ubuntu:~/bin$ cd cassandra

cassandra@ubuntu:~/bin/cassandra$ cd conf

cassandra.yaml --> 기본적인 설정들

log4j-server.properties --> 로그 설정들.


2. 실행하는 방법 

cassandra@ubuntu:~$ bin/cassandra/bin/cassandra

xss =  -ea -javaagent:bin/cassandra/bin/../lib/jamm-0.2.5.jar -XX:+UseThreadPriorities -XX:ThreadPriorityPolicy=42 -Xms753M -Xmx753M -Xmn100M -XX:+HeapDumpOnOutOfMemoryError -Xss180k

 INFO 07:44:21,693 Logging initialized

 INFO 07:44:21,697 JVM vendor/version: Java HotSpot(TM) Client VM/1.6.0_37

 INFO 07:44:21,697 Heap size: 779091968/780140544

 INFO 07:44:21,698 Classpath: bin/cassandra/bin/../conf:bin/cassandra/bin/../build/classes/main:bin/cassandra/bin/../build/classes/thrift:bin/cassandra/bin/../lib/antlr-3.2.jar:bin/cassandra/bin/../lib/apache-cassandra-1.1.6.jar:bin/cassandra/bin/../lib/apache-cassandra-clientutil-1.1.6.jar:bin/cassandra/bin/../lib/apache-cassandra-thrift-1.1.6.jar:bin/cassandra/bin/../lib/avro-1.4.0-fixes.jar:bin/cassandra/bin/../lib/avro-1.4.0-sources-fixes.jar:bin/cassandra/bin/../lib/commons-cli-1.1.jar:bin/cassandra/bin/../lib/commons-codec-1.2.jar:bin/cassandra/bin/../lib/commons-lang-2.4.jar:bin/cassandra/bin/../lib/compress-lzf-0.8.4.jar:bin/cassandra/bin/../lib/concurrentlinkedhashmap-lru-1.3.jar:bin/cassandra/bin/../lib/guava-r08.jar:bin/cassandra/bin/../lib/high-scale-lib-1.1.2.jar:bin/cassandra/bin/../lib/jackson-core-asl-1.9.2.jar:bin/cassandra/bin/../lib/jackson-mapper-asl-1.9.2.jar:bin/cassandra/bin/../lib/jamm-0.2.5.jar:bin/cassandra/bin/../lib/jline-0.9.94.jar:bin/cassandra/bin/../lib/json-simple-1.1.jar:bin/cassandra/bin/../lib/libthrift-0.7.0.jar:bin/cassandra/bin/../lib/log4j-1.2.16.jar:bin/cassandra/bin/../lib/metrics-core-2.0.3.jar:bin/cassandra/bin/../lib/servlet-api-2.5-20081211.jar:bin/cassandra/bin/../lib/slf4j-api-1.6.1.jar:bin/cassandra/bin/../lib/slf4j-log4j12-1.6.1.jar:bin/cassandra/bin/../lib/snakeyaml-1.6.jar:bin/cassandra/bin/../lib/snappy-java-1.0.4.1.jar:bin/cassandra/bin/../lib/snaptree-0.1.jar:bin/cassandra/bin/../lib/jamm-0.2.5.jar

 INFO 07:44:21,699 JNA not found. Native methods will be disabled.

 INFO 07:44:21,710 Loading settings from file:/home/cassandra/bin/apache-cassandra-1.1.6/conf/cassandra.yaml

 INFO 07:44:21,826 32bit JVM detected.  It is recommended to run Cassandra on a 64bit JVM for better performance.

 INFO 07:44:21,826 DiskAccessMode 'auto' determined to be standard, indexAccessMode is standard

 INFO 07:44:22,008 Global memtable threshold is enabled at 248MB

 INFO 07:44:22,239 Initializing key cache with capacity of 37 MBs.

 INFO 07:44:22,249 Scheduling key cache save to each 14400 seconds (going to save all keys).

 INFO 07:44:22,253 Initializing row cache with capacity of 0 MBs and provider org.apache.cassandra.cache.SerializingCacheProvider

 INFO 07:44:22,258 Scheduling row cache save to each 0 seconds (going to save all keys).

 INFO 07:44:22,353 Opening /home/cassandra/data/system/Versions/system-Versions-hf-1 (247 bytes)

 INFO 07:44:22,379 Opening /home/cassandra/data/system/LocationInfo/system-LocationInfo-hf-6 (346 bytes)

 INFO 07:44:22,385 Opening /home/cassandra/data/system/LocationInfo/system-LocationInfo-hf-5 (163 bytes)

 INFO 07:44:22,445 Couldn't detect any schema definitions in local storage.

 INFO 07:44:22,446 Found table data in data directories. Consider using the CLI to define your schema.

 INFO 07:44:22,467 completed pre-loading (2 keys) key cache.

 INFO 07:44:22,596 Replaying /home/cassandra/commitlog/CommitLog-1353080634664.log, /home/cassandra/commitlog/CommitLog-1353080634663.log

 INFO 07:44:22,606 Replaying /home/cassandra/commitlog/CommitLog-1353080634664.log

 INFO 07:44:22,615 Finished reading /home/cassandra/commitlog/CommitLog-1353080634664.log

 INFO 07:44:22,616 Replaying /home/cassandra/commitlog/CommitLog-1353080634663.log

 INFO 07:44:22,655 Finished reading /home/cassandra/commitlog/CommitLog-1353080634663.log

 INFO 07:44:22,687 Enqueuing flush of Memtable-Versions@19288329(83/103 serialized/live bytes, 3 ops)

 INFO 07:44:22,692 Writing Memtable-Versions@19288329(83/103 serialized/live bytes, 3 ops)

 INFO 07:44:22,742 Completed flushing /home/cassandra/data/system/Versions/system-Versions-hf-2-Data.db (247 bytes) for commitlog position ReplayPosition(segmentId=1353080662588, position=0)

 INFO 07:44:22,750 Log replay complete, 3 replayed mutations

 INFO 07:44:22,777 Cassandra version: 1.1.6

 INFO 07:44:22,777 Thrift API version: 19.32.0

 INFO 07:44:22,780 CQL supported versions: 2.0.0,3.0.0-beta1 (default: 2.0.0)

 INFO 07:44:22,846 Loading persisted ring state

 INFO 07:44:22,849 Starting up server gossip

 INFO 07:44:22,856 Enqueuing flush of Memtable-LocationInfo@29499086(29/36 serialized/live bytes, 1 ops)

 INFO 07:44:22,859 Writing Memtable-LocationInfo@29499086(29/36 serialized/live bytes, 1 ops)

 INFO 07:44:22,871 Completed flushing /home/cassandra/data/system/LocationInfo/system-LocationInfo-hf-7-Data.db (80 bytes) for commitlog position ReplayPosition(segmentId=1353080662588, position=363)

 INFO 07:44:22,892 Starting Messaging Service on port 7000

 INFO 07:44:22,904 Using saved token 77712367279614969246272394525491308416

 INFO 07:44:22,911 Enqueuing flush of Memtable-LocationInfo@12254719(53/66 serialized/live bytes, 2 ops)

 INFO 07:44:22,917 Writing Memtable-LocationInfo@12254719(53/66 serialized/live bytes, 2 ops)

 INFO 07:44:22,944 Completed flushing /home/cassandra/data/system/LocationInfo/system-LocationInfo-hf-8-Data.db (163 bytes) for commitlog position ReplayPosition(segmentId=1353080662588, position=544)

 INFO 07:44:22,959 Node master/192.168.0.20 state jump to normal

 INFO 07:44:22,960 Bootstrap/Replace/Move completed! Now serving reads.


3.끝내는 방법

cassandra@ubuntu:~$ pkill -f 'java.*cassandra'

쉽다 너무..@.@


다음번에는 Cassandra의 Key,Column,Value에 대해서 설명하고 사용하는 것에 대해서 이야기하겠습니다.


블로그 이미지

커뉴

이 세상에서 꿈 이상으로 확실한 것을, 인간은 가지고 있는 것일까?

,