앤서블 설치 방법


1. 패키지 관리자 (brew나 pip 등)를 사용한다.


$ sudo pip install ansible



2. virtualenv에 연동할 수 있다.


$ wget https://raw.githubusercontent.com/mitsuhiko/pipsi/master/get-pipsi.py 

$ python get-pipsi.py 

$ pipsi install ansible





'Ansible-Puppet-Chef' 카테고리의 다른 글

ansible-galaxy  (0) 2019.01.14
[ansible] ubuntu 16에 no_proxy가 안먹는 이슈가  (0) 2019.01.09
[ansible] lineinfile  (0) 2018.07.05
[ansible] 배포될 서버의 호스트명 얻는 방법  (0) 2018.04.02
[ansible] become  (0) 2018.02.01
Posted by '김용환'
,



쿠버네티스에서 데몬셋에 대한 히스토리(history)를 확인할 수 있고, 롤백도 가능한다.




아래는 데몬셋 ds-one에 nginx 이미지를 1.7.9로 했다가 1.8.1-alpine으로 변경했고 이를 변경 전 버전으로 롤백하는 예시이다.



$ kubectl rollout history ds ds-one

daemonsets "ds-one"

REVISION CHANGE-CAUSE

1 <none>

2 <none>      



$ kubectl rollout history ds ds-one --revision=1

daemonsets "ds-one" with revision #1

Pod Template:

Labels: system=DaemonSetOne

Containers:

nginx:

Image: nginx:1.7.9

Port: 80/TCP

Environment: <none>

Volumes: <none>



$ kubectl rollout history ds ds-one --revision=2

....

Image: nginx:1.8.1-alpine



$ kubectl rollout undo ds ds-one --to-revision=1

daemonset.extensions/ds-one rolled back


Posted by '김용환'
,

[spark] 셔플 관련 자료

scala 2018. 12. 4. 14:39



spark에는 여러 셔플(shuffle) 함수의 성능적인 부분을 설명한 자료이다.





Everyday I'm Shuffling - Tips for Writing Better Spark Programs, Strata San Jose 2015 from Databricks




책으로 보려면, 아래 책을 참고하깅 바란다. 


Scala and Spark for Big Data Analytics: Explore the concepts of functional programming, data streaming, and machine learning 


https://www.amazon.com/Scala-Spark-Big-Data-Analytics/dp/1785280848


Posted by '김용환'
,





sql console로는 update_date 컬럼에 between..and 를 검색했더니 잘 동작했다.


select hostname, domain from server where update_date BETWEEN '2018-11-28' AND '2018-11-28 23:59:59'



코드에 반영했지만 아래와 같은 에러가 발생했다.


ORA-01843: not a valid month


아래 쿼리로 확인해도 정상적으로 AMERICAN으로 잘 나왔다.



select * from nls_session_parameters where parameter = NLS_DATE_LANGUAGE;





원인은 컬럼에 timestamp 타입인지 명시하지 않아서 발생한 것이다. 


따라서 아래와 같이 TO_TIMESTAMP를 사용하는 방식을 사용하면 정상적으로 작동한다.



select hostname, domain from server where update_date BETWEEN  TO_TIMESTAMP('2018-11-28 00:00:00', 'YYYY-MM-DD HH24:MI:SS') AND TO_TIMESTAMP('2018-11-28 23:59:59', 'YYYY-MM-DD HH24:MI:SS')



Posted by '김용환'
,





스파크는 선형 회귀 알고리즘의 RDD 기반 구현을 제공한다. 

https://spark.apache.org/docs/latest/mllib-linear-methods.html#regression




SGD(stochastic gradient descent)를 사용해 정규화가 필요 없는 선형 회귀 모델을 학습시킬 수 있다. 이는 다음과 같은 최소 제곱 회귀(least squares regression) 공식을 풀 수 있다.


정규화가 없는 선형 회귀 모델은 최소 제곱 회귀 공식을 사용할 수 있다는 뜻인데. 이게 즉, 평균 제곱 오차와 같다는 내용입니다. 


https://thebook.io/006958/part02/ch03/03/



f(가중치) = 1/n ||A 가중치-y||2 (즉, 평균 제곱 오차(MSE, mean squared error)다)




여기서 데이터 행렬은 n개의 로우를 가지며, 입력 RDD는 A의 로우 셋을 보유하고 각각은 해당 오른쪽 레이블 y를 가진다. 





https://github.com/apache/

spark/blob/master/mllib/src/main/scala/org/apache/spark/mllib/regression/LinearRegression.scala를 참조한다.





참고로, 예측값과 타깃값의 차이를 제 곱하여 더한 후에 샘플의 개수로 평균을 내면 평균 제곱 오차입니다.

https://en.wikipedia.org/wiki/Mean_squared_error






Posted by '김용환'
,