일래스틱서치에서는 인덱스 이름을 변경할 수 있는 방법이 거의 없지만..


유일하게 스냅샷을 복구할 때 인덱스 이름을 유일하게 변경할 수 있다.




$ curl -XPOST "http://localhost:9200/_snapshot/es/snapshot_1/_restore" -d'

{

"indices": "my_index",

"ignore_unavailable": "true",

"rename_replacement": "your_index"

}'



Posted by '김용환'
,


먼저 저장소 경로를 등록한다. vi conf/elasticsearch.yml에서 다음을 추가한다. 


path.repo: ["/tmp/mnt"] 



파일 시스템 저장소를 등록한다.


curl -XPUT 'http://localhost:9200/_snapshot/es-backup' -d '{

"type": "fs",

"settings": {

"location": "/tmp/mnt/es-backup",

"compress": true

}

}'



만약 conf/elasticsearch.yml 파일에서 path.repo를 등록하지 않으면 다음 에러가 발생한다. 


{"error":{"root_cause":[{"type":"repository_exception","reason":"[es-backup] location [/tmp/es-backup] doesn't match any of the locations specified by path.repo because this setting is empty"}],"type":"repository_exception","reason":"[es-backup] failed to create repository","caused_by":{"type":"repository_exception","reason":"[es-backup] location [/tmp/es-backup] doesn't match any of the locations specified by path.repo because this setting is empty"}},"status":500}





snapshot 저장하기


$ curl -XPUT 'http://localhost:9200/_snapshot/es-backup/snapshot_1?wait_for_completion=true' -d '{

> "indices": "index_1,index_2",

> "ignore_unavailable": "true",

> "include_global_state": false

> }'

{"snapshot":{"snapshot":"snapshot_1","uuid":"gD2dYNYzQjevg3S6PbV0Fg","version_id":5030199,"version":"5.3.1","indices":[],"state":"SUCCESS","start_time":"2017-06-08T02:41:58.489Z","start_time_in_millis":1496889718489,"end_time":"2017-06-08T02:41:58.496Z","end_time_in_millis":1496889718496,"duration_in_millis":7,"failures":[],"shards":{"total":0,"failed":0,"successful":0}}}[/usr/local/elasticsearch-5.3.1/bin]





스냅샷 정보를 얻어오려면 다음 커맨드를 사용한다. 


curl -XGET 'http://localhost:9200/_snapshot/es-backup/snapshot_1'

{"snapshots":[{"snapshot":"snapshot_1","uuid":"gD2dYNYzQjevg3S6PbV0Fg","version_id":5030199,"version":"5.3.1","indices":[],"state":"SUCCESS","start_time":"2017-06-08T02:41:58.489Z","start_time_in_millis":1496889718489,"end_time":"2017-06-08T02:41:58.496Z","end_time_in_millis":1496889718496,"duration_in_millis":7,"failures":[],"shards":{"total":0,"failed":0,"successful":0}}]}





curl -XGET 'http://localhost:9200/_snapshot/es-backup/snapshot_1,snapshot_2'





curl -XGET 'http://localhost:9200/_snapshot/es-backup/_all'

'{"snapshots":[{"snapshot":"snapshot_1","uuid":"gD2dYNYzQjevg3S6PbV0Fg","version_id":5030199,"version":"5.3.1","indices":[],"state":"SUCCESS","start_time":"2017-06-08T02:41:58.489Z","start_time_in_millis":1496889718489,"end_time":"2017-06-08T02:41:58.496Z","end_time_in_millis":1496889718496,"duration_in_millis":7,"failures":[],"shards":{"total":0,"failed":0,"successful":0}}]}




스냅샷 삭제하는 방법은 다음과 같다. 


curl -XDELETE 'http://localhost:9200/_snapshot/es-backup/snapshot_1'



Posted by '김용환'
,




맥북에서 크롬캐스트2(TV)로 동기화하기


간단한 앱으로는 airflow 라는 앱이 있다. 개발이 중단된 것 같다. 음성 조절은 안드로이드폰에서 되는 단점이 있다.

1080p는 좀 버벅거린다.

http://airflowapp.com/



크롬 웹 스토어에 크롬 캐스트 앱이 있는데, 1080p 비디오가 버벅거리지 않고 소리 조절도 편하게 된다.

광고가 나온다는 단점이 있고 유료화에 대한 이슈가 있다.

https://chrome.google.com/webstore/search/videostream%20for%20google%20chromecast?utm_source=chrome-ntp-icon







Posted by '김용환'
,