2021의 게시물 표시

Kubernetes 3 masters on ceontos7

이미지
  ===========사전작업=========== hostnamectl set-hostname k8s-m01 vi /etc/hosts 10.0.2.221 k8s-m01 10.0.2.222 k8s-m02 10.0.2.223 k8s-m03 10.0.2.220 k8s-vip ============커널업데이트================== mkdir -p /etc/yum.repos.d/bak cd /etc/yum.repos.d mv *.repo ./bak curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo curl -o /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo find . -name "*.repo" -exec sed -i 's/gpgcheck=1/gpgcheck=0/g' {} \; yum -y update rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-3.el7.elrepo.noarch.rpm yum --enablerepo=elrepo-kernel install -y kernel-ml grub2-mkconfig -o /boot/grub2/grub.cfg grub2-set-default 0 reboot uname -a ======================소프트웨어 설치 준비========= yum install -y yum-utils device-mapper-persistent-data lvm2 yum-config-manager -y --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo cat <<EOF ...

Centos7 시간 동기화 (NTP)

 yum install ntp firewall-cmd --add-service=ntp --permanent firewall-cmd --reload systemctl start ntpd systemctl enable ntpd

postgres docker 설치

docker search postgres docker pull postgres docker run --name pgsql -d -p 5432:5432 -e POSTGRES_PASSWORD=비밀번호 postgres docker exec -it pgsql bash psql -U postgres CREATE DATABASE first; alter user postgres with password '비밀번호'; l c first ufw allow 5432

Docker 설치 on CentOS8

  dnf install docker-ce docker-ce-cli containerd.io --nobest

Local 과 Remote 저장소 연결 및 작업

cd c:\workdspace  [로컬과 원격저장소 연결] git remote add 별칭 https://github.com/inet815/study.git git remote -v    연결확인 ===========로컬에서 작업======== git push origin --all   로컬 작업의 모든 브랜치를 push ==========리모트와 로컬의 같은 파일을 로컬에서 변경 git push origin master   로컬 작업을 리모트에 푸쉬 하면 충돌 발생 git fetch    리모트의 커밋정보를 가져옮 git merge origin/master    로컬의 마스터와 리모트의 msater를 통합 git diff vim 수정 git commit -a -m "confict resolved GitHub" fetch와 merge를 한번에 하는 Pull 명령어

Remote 저장소를 Local 저장소로 복제

 cd c:\workspace [원격저장소를 로컬로 복제해서 작업] git clone https://gihub.com/inet815/study.git cd study git status

Local Git 사용법

PC에 git 설치 http://git-scm.com git bash 실행 git config --global user.name "이름" git config --global user.email "이메일" c:\ mkdir workspace cd workspace git init   로컬 저장소 초기화    vim hello.py git status   깃 상태 git add hello.py   깃에서 파일 추적하도록 추가 git status   깃 상태 git commit   수정사항 커밋 git branch   브랜치 조회 git branch hotfix   hofix 브랜치 생성 git checkput (-b) hotfix    브랜치 이동   git commit -a    저장소 파일 모두 커밋 git checkout master git merge hotfix    마스터에 hotfix를 병합 touch .gitignore    http://www.gitignore.io/ 에서 OS 별로 생성되는 내용을 복사해서 붙혀넣기 git add .gitignore git commit -m ''added '.gitignore' file"    깃에서 추적이 불필요한 파일/폴더 무시 git checkout master git merge hotfix git commit -a -m "conflict resolved"    충동 발생시 vim으로 수정후 다시 커밋 git log --graph git log --stat

redis sentinel 설치 on Centos 8

이미지
뭐가 문제인지 Virtualbox 3대로 아무리 테스트해봐도 안되다가 /etc/redis-sentinel.conf 를 null로 날리고 아래 내용만 깔끔하게 넣었다 근데 된다. failover 잘된다. ㅠ.ㅠ  bind 0.0.0.0 port 26379 sentinel monitor mymaster 192.168.56.201 6379 2 sentinel down-after-milliseconds mymaster 5000 sentinel parallel-syncs mymaster 1 sentinel failover-timeout mymaster 180000 sentinel auth-pass mymaster 비번 daemonize yes pidfile /var/run/sentinel.pid logfile /var/log/redis/sentinel.log ============== /etc/redis.conf에 아래 내용 반드시 넣자 mastersauth 비밀번호 requirepass 비빌번호 ================= 1번서버에서 redis-cli auth 비번 info replication 하면 아래와 같이 마스터로 보인다 이상태에서 shutdown 하거나 서버를 끄거나 systemctl stop redis 하거나 하면 마스터가 죽고 2번이나 3번 서버에서 tail -f /var/log/redis/sentinel.log 를 보면 failover 되는것이 보인다

network 수정 및 재설정 (Centos 7 & Centos 8)

  cd /etc/sysconfig/network-scripts vi ifcfg-인터페이스면 수정후 # Centos 7 systemctl restart network    # Centos 8 systemctl restart Networkmanager.service 하라고하는데 잘 안먹히는것 같음 그냥 GUI에서 껐다 키니깐 됨 nmcli con show 하면 인터페이스 정보가 나옴

redis 설치 CentOS 8.3 Master1-Slave2 (3대의 서버에 나누어 설치)

yum install epel-release yum install redissystemctl start redis systemctl enable redisredis-cli ping ===확인==== netstat -npat | grep redis ===컨피그================== vim /etc/redis.conf bind 0.0.0.0  (접속이 필요한 아이피들 0.0.0.0은 전부다 접속) port 포트번호 (포트변경할때 사용) requirepass 비밀번호 (비밀번호 적용할때 redis-cli에서는 auth 비번) masterauth 비밀번호 (slave에 설정해서 master랑 연결됨) #appenonly yes #save 900 1 #save 300 10 #save 60 1000 ==================== ==============Master 1, Slave 2 설치============ Master Node      192.168.56.201 : 6379  Slave Node - 1   192.168.56.202 : 6379  Slave Node - 2   192.168.56.203 : 6379  Master 서버에서 /etc/redis.conf bind 0.0.0.0 port 6379 requirepass 비밀번호 daemonize  yes Slave 1번 서버에서 /etc/redis-slave1.conf bind 0.0.0.0 port 6379 slaveof 192.168.56.201 6379 masterauth 비밀번호 daemonize yes Slave 2번 서버에서 /etc/redis.conf bind 0.0.0.0 port 6379 slaveof 192.168.56.201 6379 masterauth 비밀번호 daemonize yes =====재시작 및 확인===== systemctl stop firewalld s...

git server centos8에 설치

 server============== yum install git git --version useradd git passwd git git init --bare /home/git client============= 탐색기에서 디렉토리를 만들어서  오른쪽 클릭해서 git bash 실행 mkdir .ssh cd .ssh ssh-keygen -t rsa scp id_rsa.pub git@192.168.56.202 /home/git server============== su -git mkdir /home/git/.ssh cat /home/git/id_rsa.pub >> /home/git/.ssh/authorized_keys client============ ssh -v git@192.168.56.202 (접속확인) server============== /etc/passwd git:x:1002:1003::/home/git:/usr/bin/git-shell 변경 vi /etc/shells 마지막 줄에 /bin/git-shell 추가 client==================== 적정한 디렉토리에서 git-bash 실행 git clone ssh://git@192.168.56.201:/home/git cd git touch test.txt echo "test" >> test.txt git add . git commit --message "msg" git push origin master

Windows에서 Linux로 ssh 키인증 안될때

cd /etc/ssh/sshd_config 아래 항목 주석 제거후 no로 변경 StrictModes no