StoryCode

VMWare.Docker.Centos.Airflow 직접 설치

Apache AirFlow
반응형

# 참조 : medium.com/@santosh.dadisetti/installing-the-docker-centos-apache-airflow-with-mysql-backend-1c99544d6692

 

Installing Docker + Centos + Apache Airflow with Mysql Backend

Pulling latest Centos OS from Docker hub
docker pull centos:latest
docker run -it — net=host — name airflow_server -p 8080:8080 -p 5555:5555 centos
upgrade centos OS on Docker
yum install epel-release -y
yum install gcc-c++ -y
yum install -y mysql-devel python-devel python-setuptools
install Python3.6
yum -y install https://centos7.iuscommunity.org/ius-release.rpm
yum -y install python36u
Install PIP for Python 3.6
yum -y install python36u-pip
Update Python development tools
yum -y install python36u-devel
Upgrade setuptools if needed.
pip3.6 install — upgrade pip
pip install — upgrade setuptools
Basics python packages for Apache Airflow
pip install -U pip setuptools wheel
pip install pytz
pip install pyOpenSSL
pip install ndg-httpsclient

One of the dependencies of Apache Airflow by default pulls in a GPL library (‘unidecode’). In case this is a concern you can force a non GPL library by issuing export SLUGIFY_USES_TEXT_UNIDECODE=yes and then proceed with the normal installation
https://airflow.apache.org/installation.html
export SLUGIFY_USES_TEXT_UNIDECODE=yes
install Apache Airflow
pip install apache-airflow
Intiating Airflow DB , by default Apache airflow use Sqllite
airflow initdb
Export Airflow_home to /root/airflow
export AIRFLOW_HOME=/root/airflow
Start Apache Airflow webserver
airflow webserver -p 8080
Set up Mysql as backend/Metadata DB for Apache Airflow
yum install mariadb-devel — skip-broken
pip install Apache-airflow[mysql]
on Mysql server
SET explicit_defaults_for_timestamp=1
Edit airflow.cfg on /root/airflow/airflow.cfg
# The SqlAlchemy connection string to the metadata database.
# SqlAlchemy supports many different database engine, more information
# their website
#sql_alchemy_conn = sqlite:////root/airflow/airflow.db
sql_alchemy_conn = mysql://<username>:<password>@<mysql-server>:3306/airflow
Reset/ initiate DB on airlfow
airflow initdb
and start Airflow Server
airflow webserver -p 8080

 

반응형

'Apache AirFlow' 카테고리의 다른 글

Airflow.초기화.강제 매뉴얼  (0) 2021.06.24
설치.maria db for airflow  (0) 2020.10.19
VMWare.Docker.Airflow Official Image 에 설치  (0) 2020.10.11

설치.maria db for airflow

Apache AirFlow
반응형

참조 : velog.io/@hongji3354/Docker%EB%A5%BC-%EC%82%AC%EC%9A%A9%ED%95%B4%EC%84%9C-MariaDB-%EC%84%A4%EC%B9%98%ED%95%98%EA%B8%B0

 

1) docker pull mariadb

 

2) docker run --name mariadb -d -p 3306:3306 -e MYSQL_ROOT_PASSWORD=mariadb mariadb

 

3) docker exec -it mariadb /bin/bash

 

4) mysql -u root -p

Enter password : mariadb

 

5) mysql > status

Latin1 으로 뜨는 데 utf8 로 변경

 

6) vi 가 없으므로 vi 부터 설치후, my.cnf 수정

apt-get update

apt-get install apt-file

apt-file update

apt list --upgradable

apt-get install vim

 

/etc/mysql/my.cnf 내에 아래 2줄 !includedir 이 있으면,
!includedir /etc/mysql/conf.d/
!includedir /etc/mysql/mariadb.conf.d/

cd /etc/mysql/mariadb.conf.d/
vi 50-client.cnf 50-mysql-clients.cnf 50-server.cnf

# 50-client.conf 에서
[client]
default-character-set = utf8mb4

# 50-mysql-cient.cnf 에서
[mysql]
default-character-set = utf8mb4

# 50-server.cnf 에서
[mysqld]
...
collation-server = utf8_unicode_ci
init-connect='SET NAMES utf8'
character-set-server = utf8
추가


/etc/mysql/my.cnf 내에 아래 2줄 !includedir 이 없으면 my.cnf 에 직접 추가

[client]
default-character-set = utf8mb4

[mysql]
default-character-set = utf8mb4

[mysqld]
collation-server = utf8_unicode_ci
init-connect='SET NAMES utf8'
character-set-server = utf8

 

7) docker restart [CONTAINER ID]

docker exec -it mariadb /bin/bash

 

8) 

반응형

VMWare.Docker.Airflow Official Image 에 설치

Apache AirFlow
반응형

* AWS 에 설치하는 건 잘 안된다.

* mysql plugin 을 설치하려는데 오류가 나서 설치가 안된다. 그냥 직접 설치해봐야 할 듯 하다.

 

참조 : cofs.tistory.com/407

 

# 1. docker 설치
yum -y install docker docker-registry
systemctl enable docker.service
systemctl start docker.service


# 2. airflow officall Image download
docker pull puckel/docker-airflow

docker images

 

# 참고. save as tar

docker save ...

 

# 3. run airflow

docker run -d -p 8080:8080 --name airflow_v1 docker.io/puckel/docker-airflow 
docker ps

# 4. open firewall

console > vi /etc/firewalld/zones/public.xml 
<zone>
...
  <port protocol="tcp" port="8080"/>
  <port protocol="tcp" port="80"/>
</zone>

console > firewall-cmd --reload

# 참고 )
console > systemctl start firewalld
console > systemctl enable firewalld
console > systemctl stop firewalld
console > systemctl disable firewalld
console > firewall-cmd --state # 상태 확인
console > firewall-cmd --get-active-zones # 활성화 존 목록
console > firewall-cmd --get-service # 서비스 리스트
console > firewall-cmd --zone=public --list-services # public 존 서비스 리스트

 

# 5. login airflow

http://localhost:8080

 

#

반응형

'Apache AirFlow' 카테고리의 다른 글

Airflow.초기화.강제 매뉴얼  (0) 2021.06.24
VMWare.Docker.Centos.Airflow 직접 설치  (0) 2020.10.28
설치.maria db for airflow  (0) 2020.10.19

ECR 에 AWS.EC2.Docker 이미지를 ECR 에 올리기

AWS, 아마존
반응형

* AWS.EC2 에서 작업해야 하므로, WIndows Client 에서 gitbash 로 접속한다. ( putty 로는 TTY 가 아니라고 하면서 오류 )

 

방법 1) EC2 에 ECR Role 을 추가한다.

 

방법 2)

1. AWS.EC2 에 AWS-CLI Ver 2 를 설치.

 

2. docker 가 sudo 에서 실행되다 보니, sudo docker 라고 해줘야 한다.

/usr/local/bin/aws ecr get-login-password --region ap-northeast-2 | sudo docker login --username AWS --password-stdin 2803665.dkr.ecr.ap-northeast-2.amazonaws.com

만약, 로그인 Securety 키가 필요하다고 하면, IAM 에 가서 새로 발급해야 한다.
로그인 오류가 난다면, get-login 만 호출해서 로그인만 하는 방법을 구글링해서 docs.aws.amazon.com/ 꺼를 참조한다.

 

3. 무엇을 밀어넣을지, 밀어넣을때 Tag 를 정한다.

sudo docker tag tomcat:latest 2803665.dkr.ecr.ap-northeast-2.amazonaws.com/keibi-sysae-tomcat:latest

tomcat:lastest            = docker images 했을 때 이름이다.
keibi-sysae-tomcat:latest = ECR 에 생성한 Repository 이름이다.

4. 실제 밀어 넣는다.

sudo docker push 2803665.dkr.ecr.ap-northeast-2.amazonaws.com/keibi-sysae-tomcat:latest

 

반응형

'AWS, 아마존' 카테고리의 다른 글

Docker, Docker-compose 올리기  (0) 2021.02.23
EFS 를 onpremise.NFS 에 연결하기  (0) 2021.02.01
ERROR.Permissions 0455 for 'apache-bench.pem' are too open.  (0) 2020.05.28
EC2 에 EFS 연결하기  (0) 2020.05.27
Powershell.window  (0) 2020.05.26

문법 기본

JavaScript, ECMAScript
반응형

'use strict'

 

BABEL 

 

JavaScript let varname = 123;

var 는 쓰지 말 것. Hoisting 이라고 변수를 먼저 사용후 선언해도 되는 방식.

const bigint = 1234....n
TypeScript let varname:integer = 123;

MS 개발.
Javascript + Type ( Data )
ES5 + ES6 포함.

BABEL 로 Javascript 로 변환

 

String 합치기

Console.log ("Answer ${varname}");

 

class Student
{
  constructor(name, age, enrolled, score)
  {
    this.name = name;
    this.age = age;
    this.enrolled = enrolled;
    this.score = scorre;
  }
}

const students = [
  new Student('A', 29, true,  45),
  new Student('B', 28, false, 85),
  new Student('C', 30, true,  95)
];

{
  const result = students.find(function(student, index) {
    return student.score === 90;
  };

  // 조건에 맞는 1 개의 Row 만 리턴. find
  const result = students.find(student => student.score === 90);

  // 조건에 맞는 여러개의 Row 을 Array 로 리턴 - filter
  const result = students.filter((student) => student.enrolled);

  // 45, 85, 95. 특정 컬럼을 리턴 - map
  const result = students.map((student) => student.score);

  // 조건에 맞는 경우가 있으면 True 리턴. some
  const result = students.some(student => student.score < 90);

  // 모두 조건에 맞으면 True 리턴. every
  const result = students.every(student => student.score < 90);

  // 배열 하나씩 처리할 때 쓴다. 배열의 값을 누적할 때 쓴다. - reduce
  const result = students.reduce((prev, curr) => prev + curr.score, 0);
  // 0 을 안 넣으면, 처음에는 prev = 배얼[0], curr = 배열[1] 이 넘어간다. 두번째에는 prev = 리턴값, curr = 배열[2]
  // 0 을 넣으면,    처음에는 prev = 0,       curr = 배열[0] 이 넘어간다. 리턴은 누적을 한다.

  // 응용. 50 점 넘는 점수를 join 하기.
  const result = students.map((student) => student.score)
                         .filter((score) => score >= 50)
                         .join();

  const result = students.map((student) => student.score)
                         .sort((a, b) => a-b) // Plus / Minus 에 따라서 정렬순서 정의
                         .join();

  console.log(result);
}

AJAX - XMLHttpRequest Object : Request & Respone - (new) fetch() API

 

반응형

'JavaScript, ECMAScript' 카테고리의 다른 글

import, export  (0) 2021.09.28
CORS.ajax.fetch.어떻게 해도 CORS 가 발생할 경우  (0) 2021.08.31
자바스크립트 역사.  (0) 2020.09.21
Count, 카운트  (0) 2020.03.09
실수를 정수로 바꾸는 방법  (0) 2020.03.04