elasticsearch과 hadoop을 바인딩해서 사용할 수 있다.


https://www.elastic.co/guide/en/elasticsearch/hadoop/current/reference.html



요구사항은 다음과 같다. 특이점음 1.x부터 5.5까지 하위 호환성은 유지시켜 준닥.


https://www.elastic.co/guide/en/elasticsearch/hadoop/5.5/requirements.html





하이브 주요 내용은 다음과 같다.

https://www.elastic.co/guide/en/elasticsearch/hadoop/current/hive.html



다음과 비슷하게 hive 테이블을 생성할 수 있다.


CREATE EXTERNAL TABLE IF NOT EXISTS artists (...)

STORED BY 'org.elasticsearch.hadoop.hive.EsStorageHandler'

TBLPROPERTIES('es.resource' = 'radio/artists',

              'es.index.auto.create' = 'false') ;




주요 하이브 테이블 설정은 다음과 같다. 


https://www.elastic.co/guide/en/elasticsearch/hadoop/current/configuration.html




1. 'es.resource'=하둡 디렉토리


2. 'es.input.json` = 'yes'

json 입력을 가능케 해준다. 기본값은 false이다. 문서에는 true가 아니라 'yes'라고 입력되어 있다.


es.input.json (default false)
Whether the input is already in JSON format or not (the default). Please see the appropriate section of each integration for more details about using JSON directly.



3. 'es.nodes'='${target_es_dns}'

elasticsearch node는 대부분 클러스터이기 때문에. es.node를 사용할 때는 해당 노드로 저장케 한다.



es.nodes (default localhost)
List of Elasticsearch nodes to connect to. When using Elasticsearch remotely, do set this option. Note that the list does not have to contain every node inside the Elasticsearch cluster; these are discovered automatically by elasticsearch-hadoop by default (see below). Each node can also have its HTTP/REST port specified individually (e.g. mynode:9600).


4. 'es.mapping.id' = did


document ID 로 사용한 다큐먼트 필드/프로퍼티

es.mapping.id (default none)
The document field/property name containing the document id.


5. 'es.query' = '?q=me*'

쿼리 결과도 저장할 수 있다. 



6. batch 관련 설정

'es.batch.write.refresh'='false'

'es.batch.size.bytes'='10mb'

'es.batch.size.entries'='0'




es.batch.size.bytes (default 1mb)
Size (in bytes) for batch writes using Elasticsearch bulk API. Note the bulk size is allocated per taskinstance. Always multiply by the number of tasks within a Hadoop job to get the total bulk size at runtime hitting Elasticsearch.
es.batch.size.entries (default 1000)
Size (in entries) for batch writes using Elasticsearch bulk API - (0 disables it). Companion to es.batch.size.bytes, once one matches, the batch update is executed. Similar to the size, this setting is per task instance; it gets multiplied at runtime by the total number of Hadoop tasks running.
es.batch.write.refresh (default true)
Whether to invoke an index refresh or not after a bulk update has been completed. Note this is called only after the entire write (meaning multiple bulk updates) have been executed.
es.batch.write.retry.count (default 3)
Number of retries for a given batch in case Elasticsearch is overloaded and data is rejected. Note that only the rejected data is retried. If there is still data rejected after the retries have been performed, the Hadoop job is cancelled (and fails). A negative value indicates infinite retries; be careful in setting this value as it can have unwanted side effects.





Posted by '김용환'
,


apache storm은 apache zookeeper를 필요로한다. 




* apache zookeeper 설치와 실행

http://www.apache.org/dyn/closer.cgi/zookeeper/



$ ./zkServer.sh start

ZooKeeper JMX enabled by default

Using config: /usr/local/zookeeper-3.4.10/bin/../conf/zoo.cfg

Starting zookeeper ... STARTED






* apache storm 설치 


http://storm.apache.org/downloads.html에서 설치 후 /usr/local로 옮긴다.


(archieves는 http://archive.apache.org/dist/storm/에 존재한다. 1.0.1로 테스트한다.)



설정을 변경해 local zookeeper를 바라보도록 한다. 


$ vi conf/storm.yaml


storm.zookeeper.servers:

      - localhost

nimbus.seeds: ["localhost"]





master node인 nimbus를 실행한다. 



$ ./bin/storm nimbus

Running: /Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home/bin/java -server -Ddaemon.name=nimbus .... org.apache.storm.daemon.nimbus




supervisor 노드를 실행한다.


$ ./bin/storm supervisor

Running: /Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home/bin/java -server -Ddaemon.name=supervisor... org.apache.storm.daemon.supervisor




admin ui를 위해 ui도 실행한다.


$ ./bin/storm ui

Running: /Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home/bin/java -server -Ddaemon.name=ui ... org.apache.storm.ui.core



웹 브라우져에서 http://localhost:8080에 접속해서 정상적으로 접근되는지 확인한다.




데몬을 확인한다. 

$ ps -ef | grep apache-storm


3개의 데몬 nimbus, ui, supervisor가 제대로 떠 있는지 확인할 수 있다. 


  


테스트를 위해 wordcount topology를 submit 한다. 


$ ./bin/storm jar ./examples/storm-starter/storm-starter-topologies-1.0.1.jar org.apache.storm.starter.WordCountTopology wordcount

Running: /Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home/bin/java -client -Ddaemon.name= -Dstorm.options= -Dstorm.home=/usr/local/apache-storm-1.0.1 -Dstorm.log.dir=/usr/local/apache-storm-1.0.1/logs -Djava.library.path=/usr/local/lib:/opt/local/lib:/usr/lib -Dstorm.conf.file= -cp /usr/local/apache-storm-1.0.1/lib/asm-5.0.3.jar:/usr/local/apache-storm-1.0.1/lib/clojure-1.7.0.jar:/usr/local/apache-storm-1.0.1/lib/disruptor-3.3.2.jar:/usr/local/apache-storm-1.0.1/lib/kryo-3.0.3.jar:/usr/local/apache-storm-1.0.1/lib/log4j-api-2.1.jar:/usr/local/apache-storm-1.0.1/lib/log4j-core-2.1.jar:/usr/local/apache-storm-1.0.1/lib/log4j-over-slf4j-1.6.6.jar:/usr/local/apache-storm-1.0.1/lib/log4j-slf4j-impl-2.1.jar:/usr/local/apache-storm-1.0.1/lib/minlog-1.3.0.jar:/usr/local/apache-storm-1.0.1/lib/objenesis-2.1.jar:/usr/local/apache-storm-1.0.1/lib/reflectasm-1.10.1.jar:/usr/local/apache-storm-1.0.1/lib/servlet-api-2.5.jar:/usr/local/apache-storm-1.0.1/lib/slf4j-api-1.7.7.jar:/usr/local/apache-storm-1.0.1/lib/storm-core-1.0.1.jar:/usr/local/apache-storm-1.0.1/lib/storm-rename-hack-1.0.1.jar:./examples/storm-starter/storm-starter-topologies-1.0.1.jar:/usr/local/apache-storm-1.0.1/conf:/usr/local/apache-storm-1.0.1/bin -Dstorm.jar=./examples/storm-starter/storm-starter-topologies-1.0.1.jar org.apache.storm.starter.WordCountTopology wordcount

534  [main] INFO  o.a.s.StormSubmitter - Generated ZooKeeper secret payload for MD5-digest: -8806961472207405752:-5043320726578157353

585  [main] INFO  o.a.s.s.a.AuthUtils - Got AutoCreds []

640  [main] INFO  o.a.s.StormSubmitter - Uploading topology jar ./examples/storm-starter/storm-starter-topologies-1.0.1.jar to assigned location: /usr/local/apache-storm-1.0.1/storm-local/nimbus/inbox/stormjar-609f1ee2-82e5-4111-bba2-c36b830e0b15.jar

Start uploading file './examples/storm-starter/storm-starter-topologies-1.0.1.jar' to '/usr/local/apache-storm-1.0.1/storm-local/nimbus/inbox/stormjar-609f1ee2-82e5-4111-bba2-c36b830e0b15.jar' (62432746 bytes)

[==================================================] 62432746 / 62432746

File './examples/storm-starter/storm-starter-topologies-1.0.1.jar' uploaded to '/usr/local/apache-storm-1.0.1/storm-local/nimbus/inbox/stormjar-609f1ee2-82e5-4111-bba2-c36b830e0b15.jar' (62432746 bytes)

935  [main] INFO  o.a.s.StormSubmitter - Successfully uploaded topology jar to assigned location: /usr/local/apache-storm-1.0.1/storm-local/nimbus/inbox/stormjar-609f1ee2-82e5-4111-bba2-c36b830e0b15.jar

936  [main] INFO  o.a.s.StormSubmitter - Submitting topology wordcount in distributed mode with conf {"storm.zookeeper.topology.auth.scheme":"digest","storm.zookeeper.topology.auth.payload":"-8806961472207405752:-5043320726578157353","topology.workers":3,"topology.debug":true}

1196 [main] INFO  o.a.s.StormSubmitter - Finished submitting topology: wordcount


job업로드하고 잘 실행되는지 확인할 수 있다.




실제 소스 디렉토리는 https://github.com/apache/storm/tree/1.0.x-branch/examples/storm-starter에 있다.




main 메소드는 아래 링크에 있다. 


https://github.com/apache/storm/blob/1.0.x-branch/examples/storm-starter/src/jvm/org/apache/storm/starter/WordCountTopology.java


로컬 테스트를 위해 LocalCluster를 사용하고 있고 Spout -> Bolt("split")-> Bolt("count")의 토롤리지를 구성하고 있다. 




  public static void main(String[] args) throws Exception {


    TopologyBuilder builder = new TopologyBuilder();


    builder.setSpout("spout", new RandomSentenceSpout(), 5);


    builder.setBolt("split", new SplitSentence(), 8).shuffleGrouping("spout");

    builder.setBolt("count", new WordCount(), 12).fieldsGrouping("split", new Fields("word"));


    Config conf = new Config();

    conf.setDebug(true);


    if (args != null && args.length > 0) {

      conf.setNumWorkers(3);


      StormSubmitter.submitTopologyWithProgressBar(args[0], conf, builder.createTopology());

    }

    else {

      conf.setMaxTaskParallelism(3);


      LocalCluster cluster = new LocalCluster();

      cluster.submitTopology("word-count", conf, builder.createTopology());


      Thread.sleep(10000);


      cluster.shutdown();

    }

  }




데몬을 확인하면 3개의 주요 데몬 외에.. 6개가 더 떠 있는 것을 확인할 수 있다. (주목할 점은 6700~6702!!)


$ ps -ef | grep apache-storm


  ...  org.apache.storm.daemon.worker wordcount-1-1503398931 6dd4cbd3-1f43-4f17-a90f-b470fddbccbc 6700 28fae52d-9d91-4de8-9130-fe1dff2f2487

... org.apache.storm.daemon.worker wordcount-1-1503398931 6dd4cbd3-1f43-4f17-a90f-b470fddbccbc 6701 8b53b715-0184-4639-b33f-68208cc7d2e3

...  org.apache.storm.daemon.worker wordcount-1-1503398931 6dd4cbd3-1f43-4f17-a90f-b470fddbccbc 6702 e8357b79-dd08-4d70-b4de-2bf69598eadf

비슷한 것 3개가 또 있음 

 


 


제대로 동작했는지 웹 브라우져에서 살펴볼 수 있다. 


http://localhost:8080/topology.html?id=wordcount-1-1503398931

  



http://localhost:8080/api/v1/topology/summary을 호출해 api summary로 확인할 수 있다.


$ curl http://localhost:8080/api/v1/topology/summary

{"topologies":[{"assignedTotalMem":2496.0,"owner":"samuel.kim","requestedMemOnHeap":0.0,"encodedId":"wordcount-1-1503398931","assignedMemOnHeap":2496.0,"id":"wordcount-1-1503398931","uptime":"11m 28s","schedulerInfo":null,"name":"wordcount","workersTotal":3,"status":"INACTIVE","requestedMemOffHeap":0.0,"tasksTotal":28,"requestedCpu":0.0,"replicationCount":1,"executorsTotal":28,"uptimeSeconds":688,"assignedCpu":0.0,"assignedMemOffHeap":0.0,"requestedTotalMem":0.0}],"schedulerDisplayResource":false}




목록을 확인할 수 있다. 


$ ./bin/storm list

Topology_name        Status     Num_tasks  Num_workers  Uptime_secs

-------------------------------------------------------------------

wordcount            ACTIVE     28         3            370




로그로 확인해보려면 logs 밑에 디렉토리가 있는데, 아까 봤던 ps ef로 봤던 6700~6702가 보인다. 


$ls -al logs/workers-artifacts/wordcount-1-1503398931/670

6700/ 6701/ 6702/




$ ls -al logs/workers-artifacts/wordcount-1-1503398931/6700/

gc.log.0.current    worker.log          worker.log.err      worker.log.metrics  worker.log.out      worker.pid          worker.yaml




정상적으로 작동했는지 하나 살펴본다. 


$ ls -al logs/workers-artifacts/wordcount-1-1503398931/6700/worker.log

-rw-r--r--  1 samuel.kim  staff  48832569  8 22 19:57 logs/workers-artifacts/wordcount-1-1503398931/6700/worker.log

[/usr/local/apache-storm-1.0.1] tail -n 10 logs/workers-artifacts/wordcount-1-1503398931/6700/worker.log

2017-08-22 19:57:46.245 o.a.s.d.executor [INFO] Processing received message FOR 10 TUPLE: source: split:21, stream: default, id: {}, [cow]

2017-08-22 19:57:46.245 o.a.s.d.executor [INFO] BOLT ack TASK: 13 TIME:  TUPLE: source: split:22, stream: default, id: {}, ["away"]

2017-08-22 19:57:46.245 o.a.s.d.task [INFO] Emitting: count default [cow, 4976]

2017-08-22 19:57:46.245 o.a.s.d.executor [INFO] Execute done TUPLE source: split:22, stream: default, id: {}, ["away"] TASK: 13 DELTA:

2017-08-22 19:57:46.245 o.a.s.d.executor [INFO] BOLT ack TASK: 10 TIME:  TUPLE: source: split:21, stream: default, id: {}, [cow]

2017-08-22 19:57:46.245 o.a.s.d.executor [INFO] Execute done TUPLE source: split:21, stream: default, id: {}, [cow] TASK: 10 DELTA:

2017-08-22 19:57:46.246 o.a.s.d.executor [INFO] Processing received message FOR 7 TUPLE: source: split:19, stream: default, id: {}, ["am"]

2017-08-22 19:57:46.246 o.a.s.d.task [INFO] Emitting: count default [am, 5050]

2017-08-22 19:57:46.246 o.a.s.d.executor [INFO] BOLT ack TASK: 7 TIME:  TUPLE: source: split:19, stream: default, id: {}, ["am"]

2017-08-22 19:57:46.246 o.a.s.d.executor [INFO] Execute done TUPLE source: split:19, stream: default, id: {}, ["am"] TASK: 7 DELTA:






deactivate 할 수도 있다. 


$ ./bin/storm deactivate wordcount

1650 [main] INFO  o.a.s.c.deactivate - Deactivated topology: wordcount




list로 상태를 본다.


$ ./bin/storm list

Topology_name        Status     Num_tasks  Num_workers  Uptime_secs

-------------------------------------------------------------------

wordcount            INACTIVE   28         3            617








kill해본다.

$./bin/storm kill wordcount

1696 [main] INFO  o.a.s.c.kill-topology - Killed topology: wordcount


ui에서 목록이 사라진다. 


$ curl http://localhost:8080/api/v1/topology/summary

{"topologies":[],"schedulerDisplayResource":false}



웹 브라우저에서 http://localhost:8080/index.html를 열어보면 wordcount topology가 보이지 않거나 wordcount topology가 나타나되 KILLED 상태인 것을 확인할 수도 있다. 

잠깐 wordcount topology가 보여도 결국은 사라진다..





nimbus를 중지해야 worker 데몬은 모두 종료된다. SPOF의 위험성이 높긴 하다.. 


Posted by '김용환'
,



* storm 소개


역시 한글 자료

http://d2.naver.com/helloworld/484148


http://bcho.tistory.com/994 


큰 그림

https://blog.twitter.com/engineering/en_us/a/2011/a-storm-is-coming-more-details-and-plans-for-release.html


(paper) storm internals 부분

http://db.cs.berkeley.edu/cs286/papers/storm-sigmod2014.pdf




* apache storm 커미터인 임정택씨가 쓴 글


https://medium.com/@heartsavior/%EC%96%B4%EC%A9%8C%EB%8B%A4-%EB%82%98%EB%8A%94-open-source-committer-%EA%B0%80-%EB%90%98%EC%97%88%EB%82%98-3-apache-storm-and-more-7baf4d68cd20





* 트위터가 storm 대신 heron을 만들고 있음

좋은 성능과 클라우드 환경(yarn, mesos, aurora)을 지원


Heron is designed with the goal of operating in a cloud environment on top of a scheduling framework such as Aurora or YARN (although it can also run in local mode). As a result, it leverages the resource isolation mechanisms implemented by these frameworks. Storm, on the other hand implements parts of the functionality of the Heron Resource Manager, the Heron Scheduler and the underlying scheduling framework in the same abstraction.


https://www.infoq.com/news/2015/06/twitter-storm-heron 


https://blog.twitter.com/engineering/en_us/a/2015/flying-faster-with-twitter-heron.html


https://twitter.github.io/heron/docs/concepts/architecture/


https://blog.acolyer.org/2017/06/29/twitter-heron-towards-extensible-streaming-engines/


http://dl.acm.org/citation.cfm?id=2742788

Posted by '김용환'
,


각 카산드라 노드에는 특정 토큰 범위가 지정되며 모든 데이터의 부분 집합을 담당한다. 

파티션 키 해시 생성을 담당하는 컴포넌트를 파티셔녀(partitioner)라 한다. 따라서 파티셔너는 주어진 파티션 키의 해시를 계산할 때 사용되며 데이터가 어느 노드에 위치해야 하는지 결정하는 해시 함수이다. 카산드라는 3개의 파티셔너를 제공한다.




1. Murmur3Partitioner : 카산드라 1.2이후의 기본 파티션이다. 해당 파티셔너는 머머(Murmur) 해시 값을 계산하여 클러스터 전체에 데이터를 균일하게 분배한다. 머머 해시 값의 범위는 -263에서 -263-1이다. 해당 파티셔너는 해싱 알고리즘이 빠르고 다른 파티셔너보다 성능이 뛰어나기 때문에 선호된다.



2. RandomPartitioner : 해당 파티셔너는 파티션 키의 MD5 해시 값을 계산해 데이터를 균일하게 분산한다. 해당 파티셔너는 카산드라 초기 버전의 기본 파티셔너였다. 해시 값의 범위는 0에서 2127-1 범위이다.



3. ByteOrderedPartitioner : 해당 파티셔너는 키 바이트 단위로 정렬된 데이터 분포를 어휘적으로 유지한다. 해당 파티셔너는 카산드라의 최신 버전(2.x)에서 사용되지 않고 앞으로 사라질 예정이다. 하지만 예전부터 사용해왔기 때문에 삭제는 되지 않은 상태이다. 해당 파티셔너는 일반적으로 핫스팟(hotspot)과 고르지 않은 로드 밸런싱을 유발시킬 수 있어서 사용하지 않는 것이 좋다.

Posted by '김용환'
,



https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-threadpool.html



Thread pool typesedit

The following are the types of thread pools and their respective parameters:

fixededit

The fixed thread pool holds a fixed size of threads to handle the requests with a queue (optionally bounded) for pending requests that have no threads to service them.

The size parameter controls the number of threads, and defaults to the number of cores times 5.

The queue_size allows to control the size of the queue of pending requests that have no threads to execute them. By default, it is set to -1 which means its unbounded. When a request comes in and the queue is full, it will abort the request.

thread_pool:
    index:
        size: 30
        queue_size: 1000

scalingedit

The scaling thread pool holds a dynamic number of threads. This number is proportional to the workload and varies between the value of the core and max parameters.

The keep_alive parameter determines how long a thread should be kept around in the thread pool without it doing any work.

thread_pool:
    warmer:
        core: 1
        max: 8
        keep_alive: 2m


Posted by '김용환'
,

[펌] fluentd 성능

Cloud 2017. 8. 21. 18:46

https://github.com/fluent/fluentd-benchmark/tree/master/one_forward



CPU	Xeon E5-2670 2.60GHz x 2 (32 Cores)
Memory	24G
Disk	300G(10000rpm) x 2 [SAS-HDD]
OS CentOS release 6.2 (Final)

Result

Agent
rate of writing (lines/sec)reading (lines/sec)CPU (%)Memory (kB)Remarks
10100.229304
1001000.335812
100010001.337864
10000100006.639912
1000001000006239912
200000157148100.436280MAX
300000N/A
400000N/A
5247047N/AMAX of dummer tool


'Cloud' 카테고리의 다른 글

[etcd] etcd 설치와 간단 예제  (0) 2017.08.23
fluent-plugin-extract_query_params  (0) 2017.08.23
[td-agent] td-agent 설치 및 테스트  (0) 2017.08.18
fluentd 공부  (0) 2017.08.16
[펌] 한국 오픈 스택 2017 자료 올라옴  (0) 2017.08.16
Posted by '김용환'
,


elasticsearch에 실수로 long time 쿼리를 실행했지만... 요청을 더 이상 실행하고 싶지 않다면, 재시작을 하는 것이 좋다. 다. 





만약 elasticsearch 2.x 이상의 버전을 사용하고 있다면..다음을 참조한다. 


https://www.elastic.co/guide/en/elasticsearch/reference/current/tasks.html



GET _tasks 호출 후, 해당 task_id를 찾은 후 POST _tasks/node_id:task_id/_cancel를 호출한다..


Posted by '김용환'
,


td-agent 설치하는 예제이다. td-agent는 fluentd의 래퍼 프로그램이다. 



rpm은 다음 링크로 설치한다. 


http://docs.fluentd.org/articles/install-by-rpm




$ sudo usermod -a -G adm td-agent

$ sudo -E /usr/sbin/td-agent-gem install fluent-plugin-record-reformer -v 0.8.2

$ sudo -E /usr/sbin/td-agent-gem install fluent-plugin-grep -v 0.3.4

$ sudo -E /usr/sbin/td-agent-gem install fluent-plugin-fields-parser -v 0.1.1




설치가 제대로 되었는지 확인한다. 


$ td-agent --version

td-agent 0.12.12





설정 파일을 생성한다.


$ sudo vi /etc/td-agent/td-agent.conf



 <source>

    type tail

    path /tmp/test.log

    pos_file /var/run/td-agent/test.log.pos

    tag public.test-service1.raw

    format /^(?<time>\S+ \S+) - \[(?<level>\S+)\] (?<msg>.+)/

    time_format %Y-%m-%d %H:%M:%S,%L

  </source>

  <match public.test-service1.raw>

    type record_reformer

    enable_ruby false

    tag public.test-service1

    <record>

      hostname ${hostname}

      phase alpha

    </record>

  </match>

  <match public.test-service1>

    type stdout

  </match>
</source>

  


문법을 확인한다.


sudo td-agent -c /etc/td-agent/td-agent.conf



데몬 실행 후 /tmp/test.log 로그를 확인한다.



2017-08-18 19:39:39,000 - [WARN] time over

2017-08-18 19:39:39 +0900 public.test-service1: {"level":"WARN","msg":"time over","hostname":"aaaaa.google.com","phase":"alpha"}



잘 동작하면 td-agent가 계속 동작하도록 한다.


sudo /sbin/chkconfig td-agent on

'Cloud' 카테고리의 다른 글

fluent-plugin-extract_query_params  (0) 2017.08.23
[펌] fluentd 성능  (0) 2017.08.21
fluentd 공부  (0) 2017.08.16
[펌] 한국 오픈 스택 2017 자료 올라옴  (0) 2017.08.16
[펌] fluentd 사용 사례  (0) 2017.08.15
Posted by '김용환'
,



elasticsearch의 쓰레드 상태를 보려면 다음과 같은 _cat/thread_pool 를 본다. 


$ curl -s http://abc.google.com:9200/_cat/thread_pool


abc.google.com           bulk                 7  0  784202

abc.google.com           fetch_shard_started  0  0       0

abc.google.com           fetch_shard_store    0  0       0

abc.google.com           flush                0  0       0

abc.google.com           force_merge          0  0       0

abc.google.com           generic              0  0       0

abc.google.com           get                  0  0       0





3,4,5번째 컬럼은 active, queue, rejected를 의미한다. 


bulk api thread가 더이상 요청을 받지 못해 rejected 된 현황을 보여준다. 

Posted by '김용환'
,



* master 브랜치 기반의 PR(pull request) 



먼저 github 원격 저장소를 내 저장소로 fork한다. 


내 github 저장소를 origin, 원격 githubub 저장소를 real이라고 지정한다. 




# git clone https://github.com/samuel-kim/optools.git


# git remote add real https://github.com/cassandra/optools.git


# git remote -v


origin https://github.com/samuel-kim/optools.git (fetch)

origin https://github.com/samuel-kim/optools.git (push)

real https://github.com/cassandra/optools.git (fetch)

real https://github.com/cassandra/optools.git (push)




내 저장소의 master 브랜치를 기반으로 새로운 브랜치를 만든다. 


git checkout -b fix_errata


코드 수정하고 푸시한다. 


git add .

git commit -m 'fix errata'

git push origin




원격 github 웹 페이지에 접속하면 "Compare & pull reqeust"이 보인다.

어느 브랜치에 PR할지 결정한다. 


PR이 완료되면, master 브랜치로 이동한다.


git checkout master


기존 브랜치를 삭제한다. 


git branch -d fix_errata


리모트 브랜치를 삭제한다. 


git push origin --delete fix_errata



real의 master를 origin의 master에 merge한다. 즉 원격 github 저장소의 master에 머징된 내용(새로워짐)을 내 저장소의 master(구버전)로 병합한다. 


현재 origin master로 되어 있다. origin master(내꺼)를 기준으로 원본 real의 master(기준)의 내용을 rebase한다. 


$ git branch -l

* master


$ git rebase real/master



origin master에 push한다. 


git push origin origin/master





이미 origin 저장소의 브랜치로 checkout된 상태에서 

저 멀리 real 은 코드 푸시가 다량으로 일어날  있고, 시간이 지나면서 내 저장소인 origin과의 소스 커밋 차이가 발생한다.


그 때는 브랜치에서 다음 커맨드를 실행해 브랜치 상황을 살펴 본다.


git pull real



만약 master만 real 브랜치의 새로운 버전으로 다운받고 싶다면 다음 커맨드를 실행한다.


git pull real master


그리고 push하면 동일하게 맞춰진다. 


git push 





Posted by '김용환'
,