* iterm2에서 소리 안나게 하는 방법


Preferences -> Profiles -> Terminal tab -> Check "Silence bell"



Posted by '김용환'
,


etcd 실행(2.2.5 기준)




$ curl -L  https://github.com/coreos/etcd/releases/download/v2.2.5/etcd-v2.2.5-darwin-amd64.zip -o etcd-v2.2.5-darwin-amd64.zip


$ unzip etcd-v2.2.5-darwin-amd64.zip



$ cd etcd-v2.2.5-darwin-amd64

$ ./etcd




커맨드 사용 방법


$ ./etcdctl ls -h

NAME:

   ./etcdctl ls - retrieve a directory


USAGE:

   ./etcdctl ls [command options] [arguments...]


OPTIONS:

   --sort returns result in sorted order

   --recursive returns all key names recursively for the given path

   -p append slash (/) to directories





간단한 dml 작업들 예제이다.

(ls, mkdir, set, get)



$ ./etcdctl ls


$ ./etcdctl mkdir /a/b

$ ./etcdctl ls /a

/a/b


$ ./etcdctl set /a/b/os ubuntu-16.04

ubuntu-16.04



$ ./etcdctl mkdir /a/b

$ ./etcdctl ls /a

/a/b

$ ./etcdctl set /a/b/os ubuntu-16.04

ubuntu-16.04

$ ./etcdctl get /a/b/os

ubuntu-16.04


$ ./etcdctl set /a/b/test samuel


$ ./etcdctl ls /a --recursive

/a/b

/a/b/os

/a/b/test




변경 방법이다. 


$ ./etcdctl update /a/b/os centos7


$ ./etcdctl get /a/b/os

centos6



간단한 노드 삭제 방법이다.


$ ./etcdtl rm /a/b/test


$ ./etcdctl rm /a/b/test

PrevNode.Value: samuel

$ ./etcdctl ls /a --recursive

/a/b

/a/b/os



구 zk(3.2.x 이전 버전)처럼 디렉토리를 지우기 전에 먼저 노드를 삭제해야 한다. 



$ ./etcdctl rmdir /a

Error:  108: Directory not empty (/a) [16540]

$ ./etcdctl rmdir /a/b

Error:  108: Directory not empty (/a/b) [16540]

$ ./etcdctl rm /a/b/os

PrevNode.Value: centos7

$ ./etcdctl rmdir /a/b/

$ ./etcdctl rmdir /a





모든 노드를 모두 보기


$ ./etcdctl ls --recursive



ttl 를 줄 수 있다.


$ ./etcdctl mkdir /a --ttl 3


3초 뒤에는 a가 사라져 있다.



http 관련 메소드는 따로 둔다. 


$ curl http://localhost:2379/xxx -XGET

404 page not found




백업하기


$ ps -ef | grep etcd

/opt/etcd/current/etcd --name master --data-dir /opt/etcd/data ...


$ ./etcdctl backup --data-dir /opt/etcd/data --backup-dir=/tmp/backup


$ ls -R /tmp/backup/

/tmp/backup/:

member


/tmp/backup/member:

snap  wal


/tmp/backup/member/snap:

000000000000022b-00000000062b232c.snap


/tmp/backup/member/wal:

0000000000000000-0000000000000000.wal





Posted by '김용환'
,





옵테인(optane)기술 


http://www.itworld.co.kr/news/104121


http://www.bodnara.co.kr/bbs/article.html?num=138616




클리앙 얘기


https://www.clien.net/service/board/park/10513177?po=0&od=T31&sk=title&sv=optane&category=&groupCd=&articlePeriod=2017


https://www.clien.net/service/board/park/10661561?po=0&od=T31&sk=title&sv=optane&category=&groupCd=&articlePeriod=2017


Posted by '김용환'
,

[openstack] nova cli 공부

Cloud 2017. 10. 13. 15:57

현재 테넌트의 목록을 본다.


$ nova list


테넌트에서 사용할 수 있는 flavor를 선택한다. 


$ nova flavor-list

+--------------------------------------+--------------------------------+-----------+------+-----------+------+-------+-------------+-----------+

| ID                                   | Name                           | Memory_MB | Disk | Ephemeral | Swap | VCPUs | RXTX_Factor | Is_Public |

+--------------------------------------+--------------------------------+-----------+------+-----------+------+-------+-------------+-----------+

| 0f485230-0e9e-47ec-8291-cdd68fb7d3a9 | m1.small                       | 1024      | 50   | 0         |      | 1     | 1.0         | True      |

| 0fdf9fff-fdba-4176-9855-b819211fdd80 | m1.medium                      | 4096      | 50   | 0         |      | 4     | 1.0         | True      |

..

+--------------------------------------+--------------------------------+-----------+------+-----------+------+-------+-------------+-----------+



새로운 가상 장비를 생성한다.


$ nova boot myserver --image ubuntu-16.04 --flavor m1.medium




새로 생성한 서버를 본다. 


 $ nova show myserver

+--------------------------------------+----------------------------------------------------------+

| Property                             | Value                                                    |

+--------------------------------------+----------------------------------------------------------+

| OS-DCF:diskConfig                    | MANUAL                                                   |

| OS-EXT-AZ:availability_zone          |                                                          |

| OS-EXT-SRV-ATTR:host                 |                                                          |

| OS-EXT-SRV-ATTR:hypervisor_hostname  |                                                          |

| OS-EXT-SRV-ATTR:instance_name        |                                                          |

| OS-EXT-STS:power_state               | 1                                                        |

| OS-EXT-STS:task_state                | -                                                        |

| OS-EXT-STS:vm_state                  | active                                                   |

| OS-SRV-USG:launched_at               | 2017-10-13T16:37:01.000000                               |

| OS-SRV-USG:terminated_at             | -   

| id                                   | 8c09a701-e2ed-4882-a4dd-4c6ac3fd5587                    |

...                                              |

+--------------------------------------+----------------------------------------------------------+


현재 테넌트의 인스턴스 목록 중 새로 만든 vm 장비를 확인한다.


$ nova list | grep myserver

| 667ad7ab-c488-4d93-9c49-12cbc5678ace | myserver             | ACTIVE | -          | Running     | .. |



myserver vm 장비를 삭제한다.


$ nova delete myserver

Request to delete server myserver has been accepted.



전체 테먼트를 본다.



$ nova list --all-tenants 

+----+------+-----------+--------+------------+-------------+----------+

| ID | Name | Tenant ID | Status | Task State | Power State | Networks |

+----+------+-----------+--------+------------+-------------+----------+

...

+----+------+-----------+--------+------------+-------------+----------+


전체 테넌트 중 특정 테넌트를 살펴본다. 알아서 패턴매칭한다.




$ nova list --all-tenants --name samuel.kim

+----+------+-----------+--------+------------+-------------+----------+

| ID | Name | Tenant ID | Status | Task State | Power State | Networks |

+----+------+-----------+--------+------------+-------------+----------+

...

+----+------+-----------+--------+------------+-------------+----------+



 

 전체 테넌트 목록 보기.

$ keystone tenant-list

+----------------------------------+-------------------------------------------------+---------+

|                id                |                       name                      | enabled |

+----------------------------------+-------------------------------------------------+---------+

| 5bb41814075847989d9d1d0988290091 |                   test_test_t                   |   True  |

....




테넌트 목록에서 인스턴스가 속한 테넌트를 본다.


$ keystone tenant-list | grep 9949006f512f49c8baed5b89aa902924

| 9949006f512f49c8baed5b89aa902924 |                    samuel.kim                   |   True  |




콘솔 로그를 본다.

 

$ nova console-log 8c09a701-e2ed-4882-a4dd-4c6ac3fd5587  | tail

[   91.616224] rc.local[2369]: Selecting previously unselected package python-six.

[   91.624910] rc.local[2369]: Preparing to unpack .../python-six_1.10.0-3_all.deb ...

 ..



재시작한다. 


$ nova reboot 8c09a701-e2ed-4882-a4dd-4c6ac3fd5587

Request to reboot server <Server: myserver> has been accepted.



모르면 nova help 실행하기.



참조

https://docs.openstack.org/python-openstackclient/latest/

https://docs.openstack.org/python-novaclient/pike/cli/nova.html



예를 들어 available zone을 보려면 다음을 참고해서 실행한다. 

https://docs.openstack.org/python-openstackclient/latest/cli/command-objects/availability-zone.html#availability-zone-list




$ openstack availability zone list




커맨드 실패시 다음과 같은 디버그 옵션을 줄 수 있다. 


nova --debug xxxx


Posted by '김용환'
,


ceph에는 장애 복구 툴이 존재한다.


http://docs.ceph.com/docs/jewel/cephfs/disaster-recovery/



Posted by '김용환'
,


Intel VT-X option이 BIOS에서 활성화되는지 리눅스에서 확인하는 방법이다. 



$ sudo apt-get install -y cpu-checker



$ kvm-ok

INFO: /dev/kvm exists

KVM acceleration can be used


사용할 수 있다!!




해당 패키지로 bios에서 NX 비트를 지원하는지 확인할 수 있다. (https://ko.wikipedia.org/wiki/NX_%EB%B9%84%ED%8A%B8)


$ check-bios-nx

modprobe: ERROR: could not insert 'msr': Operation not permitted



'unix and linux' 카테고리의 다른 글

Argument list too long 해결하기  (0) 2017.10.20
numactl 커맨드  (0) 2017.10.19
tcpCurrEstab  (0) 2017.09.19
유닉스/리눅스에서 위험한 명령어 : rm, crontab  (0) 2017.09.15
[ssh] tunneling 예제  (0) 2017.09.08
Posted by '김용환'
,



apache phoenix의 qps에 jdbc를 연동하려면 다음 코드를 참조해 개발할 수 있다. 


https://www.javaworld.com/article/3030214/big-data/open-source-java-projects-apache-phoenix.html?page=2



내가 테스트한 버전은 다음과 같다.


<dependency>
<groupId>org.apache.phoenix</groupId>
<artifactId>phoenix-core</artifactId>
<version>4.11.0-HBase-1.2</version>
</dependency>


phoenix 상황에 따라서는 설정 값을 주어야 하는데. 

sqlline.py를 실행할 때 hbase-site.xml를 설정하는데. 이에 맞게 jdbc의 속성에도 추가하는 것이 좋다. 



Properties props = new Properties();
props.setProperty("phoenix.schema.isNamespaceMappingEnabled", "true");
props.setProperty("phoenix.functions.allowUserDefinedFunctions", "true");
connection = DriverManager.getConnection("jdbc:phoenix:...", props);


만약 설정을 모른다 해도 어짜치 에러가 난다. pheonix를 jdbc로 연동할 때 에러가 발생하면 https://github.com/apache/phoenix/blob/master/phoenix-core/src/main/java/org/apache/phoenix/exception/SQLExceptionCode.java를 참조하는 것이 좋다.





아래 문제는 phoenix.schema.isNamespaceMappingEnabled를 추가해서. 해결했다.


java.sql.SQLException: ERROR 726 (43M10):  Inconsistent namespace mapping properites.. Cannot initiate connection as SYSTEM:CATALOG is found but client does not have phoenix.schema.isNamespaceMappingEnabled enabled





아래 문제는 phoenix.functions.allowUserDefinedFunctions를 추가해서 해결했다. 


org.apache.phoenix.schema.FunctionNotFoundException: ERROR 6001 (42F01): Function undefined. functionName=[CONCAT]




'hadoop' 카테고리의 다른 글

keytab 파일 확인/cron 사용하기  (0) 2017.12.04
[hadoop] data locality(데이터 지역성)  (0) 2017.11.25
[phoenix] PQS  (0) 2017.10.11
[hadoop] hadoop dfs count 커맨드 예제  (0) 2017.09.12
[hive] reducer에 메모리 할당하기  (0) 2017.07.27
Posted by '김용환'
,

[phoenix] PQS

hadoop 2017. 10. 11. 18:42


apache phoenix server에 접속하기 위해 jdbc 또는 sqlline을 사용할 수 있는 PQS(phoenix query server)가 있다. 


https://phoenix.apache.org/server.html



ha를 구성하기 위해 ha_proxy를 사용할 수 있다. 쓸만할 것 같다. 


https://community.hortonworks.com/articles/9377/deploying-the-phoenix-query-server-in-production-e.html

Posted by '김용환'
,



python3로 마이그레이션 하던 중에 다음과 같은 에러를 만났다.


 {%- for hostname, stat in stat.iteritems() %}

jinja2.exceptions.UndefinedError: 'dict object' has no attribute 'iteritems'





python3의 dict 클래스의 iteritems는 items로 변경되었다.







Posted by '김용환'
,



virtualenv에서 그냥 가상 환경을 실행하면 python2 환경으로 구축된다.



$ virtualenv envname




python3 환경으로 구축하고 싶다면 다음 커맨드를 실행한다.



$ virtualenv -p python3 envname



Posted by '김용환'
,