새소식

인기 검색어

Docker

6/28 vagrantfile 작성 및 haproxy, 스토리지 구성

  • -

1899  curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo apt-key add -

 1907  sudo apt-add-repository "deb [arch=amd64] https://apt.releases.hashicorp.com $(lsb_release -cs) main"
 1908  sudo apt-get update && sudo apt-get install vagrant 1902  mkdir -p vagrant/wp
 1903  cd vagrant/
 1904  cd wp
 1905  code Vagrantfile
 1906  vagrant up

<가상머신 설치하기>
#


# -*- mode: ruby -*-

# vi: set ft=ruby :


Vagrant.configure("2") do |config|
    config.vm.define "web1" do |ubuntu|
        ubuntu.vm.box = "ubuntu/focal64"
        ubuntu.vm.hostname = "web1"
        ubuntu.vm.network "private_network", ip: "192.168.200.11"
        ubuntu.vm.provider "virtualbox" do |vb|
            vb.name = "web1"
            vb.cpus = 2
            vb.memory = 2048
        end
    end  
     
    config.vm.define "web2" do |ubuntu|
        ubuntu.vm.box = "ubuntu/focal64"
        ubuntu.vm.hostname = "web2"
        ubuntu.vm.network "private_network", ip: "192.168.200.12"
        ubuntu.vm.provider "virtualbox" do |vb|
            vb.name = "web2"
            vb.cpus = 2
            vb.memory = 2048
        end
    end

    config.vm.define "lb" do |ubuntu|
        ubuntu.vm.box = "ubuntu/focal64"
        ubuntu.vm.hostname = "lb"
        ubuntu.vm.network "private_network", ip: "192.168.200.10"
        ubuntu.vm.provider "virtualbox" do |vb|
            vb.name = "lb"
            vb.cpus = 2
            vb.memory = 2048
        end
    end

    config.vm.define "db" do |ubuntu|
        ubuntu.vm.box = "ubuntu/focal64"
        ubuntu.vm.hostname = "db"
        ubuntu.vm.network "private_network", ip: "192.168.200.15"
        ubuntu.vm.provider "virtualbox" do |vb|
            vb.name = "db"
            vb.cpus = 2
            vb.memory = 2048
        end
    end

    config.vm.define "storage" do |ubuntu|
        ubuntu.vm.box = "ubuntu/focal64"
        ubuntu.vm.hostname = "storage"
        ubuntu.vm.network "private_network", ip: "192.168.200.18"
        ubuntu.vm.provider "virtualbox" do |vb|
            vb.name = "storage"
            vb.cpus = 2
            vb.memory = 2048
        end
    end
end



 


 

*접속하는법

sudo ufw status

vargrant ssh web2(가상머신이름)

 

sudo su - root

1  sudo apt update
    2  sudo apt install -y apache2
    3  echo "web2" > /var/www/html/index.html

 

 

 

http://www.haproxy.org/

 

HAProxy - The Reliable, High Performance TCP/HTTP Load Balancer

HAProxy is a free, very fast and reliable solution offering high availability, load balancing, and proxying for TCP and HTTP-based applications. It is particularly suited for very high traffic web sites and powers quite a number of the world's most visited

www.haproxy.org

 

https://roadmap.sh/devops

 

Developer Roadmaps

Community driven roadmaps, articles, guides, quizzes, tips and resources for developers to learn from, identify their career paths, know what they don't know, find out the knowledge gaps, learn and improve.

roadmap.sh

 


 

vagrant ssh lb

1  sudo apt update
    2  sudo apt search haproxy
    3  sudo apt install haproxy
    4  systemctl status haproxy
    5  history

 

(base) student@cccr:~/vagrant/wp$ vagrant ssh lb
Welcome to Ubuntu 20.04.2 LTS (GNU/Linux 5.4.0-77-generic x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage

  System information as of Mon Jun 28 05:40:58 UTC 2021

  System load:  0.0               Processes:               116
  Usage of /:   3.2% of 38.71GB   Users logged in:         0
  Memory usage: 9%                IPv4 address for enp0s3: 10.0.2.15
  Swap usage:   0%                IPv4 address for enp0s8: 192.168.200.10


1 update can be applied immediately.
To see these additional updates run: apt list --upgradable


vagrant@lb:~$ sudo apt update
Get:1 http://security.ubuntu.com/ubuntu focal-security InRelease [114 kB]
Hit:2 http://archive.ubuntu.com/ubuntu focal InRelease
Get:3 http://archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB]
Get:4 http://security.ubuntu.com/ubuntu focal-security/main amd64 Packages [741 kB]
Get:5 http://archive.ubuntu.com/ubuntu focal-backports InRelease [101 kB]
Get:6 http://archive.ubuntu.com/ubuntu focal/universe amd64 Packages [8628 kB]
Get:7 http://security.ubuntu.com/ubuntu focal-security/main amd64 c-n-f Metadata [7960 B]
Get:8 http://security.ubuntu.com/ubuntu focal-security/universe amd64 Packages [628 kB]
Get:9 http://security.ubuntu.com/ubuntu focal-security/universe Translation-en [95.9 kB]
Get:10 http://security.ubuntu.com/ubuntu focal-security/universe amd64 c-n-f Metadata [11.6 kB]
Get:11 http://security.ubuntu.com/ubuntu focal-security/multiverse amd64 Packages [19.9 kB]
Get:12 http://security.ubuntu.com/ubuntu focal-security/multiverse Translation-en [4316 B]
Get:13 http://security.ubuntu.com/ubuntu focal-security/multiverse amd64 c-n-f Metadata [528 B]
Get:14 http://archive.ubuntu.com/ubuntu focal/universe Translation-en [5124 kB]
Get:15 http://archive.ubuntu.com/ubuntu focal/universe amd64 c-n-f Metadata [265 kB]
Get:16 http://archive.ubuntu.com/ubuntu focal/multiverse amd64 Packages [144 kB]
Get:17 http://archive.ubuntu.com/ubuntu focal/multiverse Translation-en [104 kB]
Get:18 http://archive.ubuntu.com/ubuntu focal/multiverse amd64 c-n-f Metadata [9136 B]
Get:19 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages [1077 kB]
Get:20 http://archive.ubuntu.com/ubuntu focal-updates/main Translation-en [237 kB]
Get:21 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 c-n-f Metadata [13.6 kB]
Get:22 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 Packages [825 kB]
Get:23 http://archive.ubuntu.com/ubuntu focal-updates/universe Translation-en [172 kB]
Get:24 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 c-n-f Metadata [17.8 kB]
Get:25 http://archive.ubuntu.com/ubuntu focal-updates/multiverse amd64 Packages [23.6 kB]
Get:26 http://archive.ubuntu.com/ubuntu focal-updates/multiverse Translation-en [6376 B]
Get:27 http://archive.ubuntu.com/ubuntu focal-updates/multiverse amd64 c-n-f Metadata [648 B]
Get:28 http://archive.ubuntu.com/ubuntu focal-backports/main amd64 c-n-f Metadata [112 B]
Get:29 http://archive.ubuntu.com/ubuntu focal-backports/restricted amd64 c-n-f Metadata [116 B]
Get:30 http://archive.ubuntu.com/ubuntu focal-backports/universe amd64 Packages [4032 B]
Get:31 http://archive.ubuntu.com/ubuntu focal-backports/universe Translation-en [1448 B]
Get:32 http://archive.ubuntu.com/ubuntu focal-backports/universe amd64 c-n-f Metadata [224 B]
Get:33 http://archive.ubuntu.com/ubuntu focal-backports/multiverse amd64 c-n-f Metadata [116 B]
Fetched 18.5 MB in 8s (2460 kB/s)                                          
Reading package lists... Done
Building dependency tree       
Reading state information... Done
1 package can be upgraded. Run 'apt list --upgradable' to see it.
vagrant@lb:~$ sudo apt search haproxy
Sorting... Done
Full Text Search... Done
go-mmproxy/focal 1.0-1 amd64
  Golang implementation of mmproxy

golang-github-armon-go-proxyproto-dev/focal 0.0~git20190211.68259f7-2 all
  Golang package to handle HAProxy Proxy Protocol

haproxy/focal-updates 2.0.13-2ubuntu0.1 amd64
  fast and reliable load balancing reverse proxy

haproxy-doc/focal-updates 2.0.13-2ubuntu0.1 all
  fast and reliable load balancing reverse proxy (HTML documentation)

haproxy-log-analysis/focal 2.0~b0-2 all
  analyse the HTTP logs generated by HAProxy

haproxyctl/focal 1.4.3-1 all
  Utility to manage HAProxy

hitch/focal 1.5.2-1 amd64
  scalable TLS proxy

libghc-io-streams-haproxy-dev/focal 1.0.1.0-2 amd64
  HAProxy protocol 1.5 support for io-streams

libghc-io-streams-haproxy-doc/focal 1.0.1.0-2 all
  HAProxy protocol 1.5 support for io-streams; documentation

libghc-io-streams-haproxy-prof/focal 1.0.1.0-2 amd64
  HAProxy protocol 1.5 support for io-streams; profiling libraries

libprotocol-websocket-perl/focal 0.26-2 all
  Perl library that implements WebSocket protocol

nagios-plugins-contrib/focal 25.20191015+1ubuntu1 amd64
  Plugins for nagios compatible monitoring systems

postgresql-12-bgw-replstatus/focal 1.0.4 amd64
  report whether PostgreSQL node is master or standby

prometheus-haproxy-exporter/focal 0.9.0+git20180917+ds-1 amd64
  HAProxy Exporter for Prometheus

puppet-module-puppetlabs-haproxy/focal 2.1.0-1 all
  Puppet module for HAProxy

python3-haproxy-log-analysis/focal 2.0~b0-2 all
  generate aggregate statistics from HAProxy HTTP logs (Python 3)

vim-haproxy/focal-updates 2.0.13-2ubuntu0.1 all
  syntax highlighting for HAProxy configuration files

vagrant@lb:~$ sudo apt install haproxy
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  liblua5.3-0
Suggested packages:
  vim-haproxy haproxy-doc
The following NEW packages will be installed:
  haproxy liblua5.3-0
0 upgraded, 2 newly installed, 0 to remove and 1 not upgraded.
Need to get 1635 kB of archives.
After this operation, 3777 kB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://archive.ubuntu.com/ubuntu focal/main amd64 liblua5.3-0 amd64 5.3.3-1.1ubuntu2 [116 kB]
Get:2 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 haproxy amd64 2.0.13-2ubuntu0.1 [1519 kB]
Fetched 1635 kB in 3s (636 kB/s)   
Selecting previously unselected package liblua5.3-0:amd64.
(Reading database ... 63206 files and directories currently installed.)
Preparing to unpack .../liblua5.3-0_5.3.3-1.1ubuntu2_amd64.deb ...
Unpacking liblua5.3-0:amd64 (5.3.3-1.1ubuntu2) ...
Selecting previously unselected package haproxy.
Preparing to unpack .../haproxy_2.0.13-2ubuntu0.1_amd64.deb ...
Unpacking haproxy (2.0.13-2ubuntu0.1) ...
Setting up liblua5.3-0:amd64 (5.3.3-1.1ubuntu2) ...
Setting up haproxy (2.0.13-2ubuntu0.1) ...
Created symlink /etc/systemd/system/multi-user.target.wants/haproxy.service → /lib/systemd/system/haproxy.service.
Processing triggers for man-db (2.9.1-1) ...
Processing triggers for libc-bin (2.31-0ubuntu9.2) ...
Processing triggers for rsyslog (8.2001.0-1ubuntu1.1) ...
Processing triggers for systemd (245.4-4ubuntu3.7) ...
vagrant@lb:~$ systemctl status haproxy
● haproxy.service - HAProxy Load Balancer
     Loaded: loaded (/lib/systemd/system/haproxy.service; enabled; vendor p>
     Active: active (running) since Mon 2021-06-28 05:43:40 UTC; 35s ago
       Docs: man:haproxy(1)
             file:/usr/share/doc/haproxy/configuration.txt.gz
   Main PID: 7168 (haproxy)
      Tasks: 3 (limit: 2344)
     Memory: 2.0M
     CGroup: /system.slice/haproxy.service
             ├─7168 /usr/sbin/haproxy -Ws -f /etc/haproxy/haproxy.cfg -p /r>
             └─7169 /usr/sbin/haproxy -Ws -f /etc/haproxy/haproxy.cfg -p /r>

vagrant@lb:~$ history
    1  sudo apt update
    2  sudo apt search haproxy
    3  sudo apt install haproxy
    4  systemctl status haproxy
    5  history
vagrant@lb:~$ sudo -i
root@lb:~# cd /etc/haproxy/
root@lb:/etc/haproxy# ls
errors  haproxy.cfg
root@lb:/etc/haproxy# vi
root@lb:/etc/haproxy# vi
root@lb:/etc/haproxy# vi haproxy.cfg
root@lb:/etc/haproxy# systemctl restart haproxy
root@lb:/etc/haproxy# systemctl status haproxy
● haproxy.service - HAProxy Load Balancer
     Loaded: loaded (/lib/systemd/system/haproxy.service; enabled; vendor p>
     Active: active (running) since Mon 2021-06-28 05:54:19 UTC; 7s ago
       Docs: man:haproxy(1)
             file:/usr/share/doc/haproxy/configuration.txt.gz
    Process: 7938 ExecStartPre=/usr/sbin/haproxy -f $CONFIG -c -q $EXTRAOPT>
   Main PID: 7947 (haproxy)
      Tasks: 3 (limit: 2344)
     Memory: 2.2M
     CGroup: /system.slice/haproxy.service
             ├─7947 /usr/sbin/haproxy -Ws -f /etc/haproxy/haproxy.cfg -p /r>
             └─7953 /usr/sbin/haproxy -Ws -f /etc/haproxy/haproxy.cfg -p /r>

Jun 28 05:54:19 lb systemd[1]: Starting HAProxy Load Balancer...
Jun 28 05:54:19 lb haproxy[7947]: Proxy http-in started.
Jun 28 05:54:19 lb haproxy[7947]: Proxy http-in started.
Jun 28 05:54:19 lb haproxy[7947]: Proxy backend_webserver started.
Jun 28 05:54:19 lb haproxy[7947]: [NOTICE] 178/055419 (7947) : New worker #>
Jun 28 05:54:19 lb haproxy[7947]: Proxy backend_webserver started.
Jun 28 05:54:19 lb systemd[1]: Started HAProxy Load Balancer.

root@lb:/etc/haproxy# 

<Vagrantfile 수정>





# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.configure("2") do |config|
    config.vm.define "lb" do |ubuntu|
      ubuntu.vm.box = "ubuntu/focal64"
      ubuntu.vm.hostname = "lb"
      ubuntu.vm.network "private_network", ip: "192.168.200.10"
      ubuntu.vm.provider "virtualbox" do |vb|
         vb.name = "lb"
         vb.cpus = 2
         vb.memory = 2048
      end
    end
  
    config.vm.define "web1" do |ubuntu|
      ubuntu.vm.box = "ubuntu/focal64"
      ubuntu.vm.hostname = "web1"
      ubuntu.vm.network "private_network", ip: "192.168.200.11"
      ubuntu.vm.provider "virtualbox" do |vb|
         vb.name = "web1"
         vb.cpus = 2
         vb.memory = 2048
      end
    end
  
    config.vm.define "web2" do |ubuntu|
      ubuntu.vm.box = "ubuntu/focal64"
      ubuntu.vm.hostname = "web2"
      ubuntu.vm.network "private_network", ip: "192.168.200.12"
      ubuntu.vm.provider "virtualbox" do |vb|
         vb.name = "web2"
         vb.cpus = 2
         vb.memory = 2048
      end
    end
  
    config.vm.define "db" do |ubuntu|
      ubuntu.vm.box = "ubuntu/focal64"
      ubuntu.vm.hostname = "db"
      ubuntu.vm.network "private_network", ip: "192.168.200.15"
      ubuntu.vm.provider "virtualbox" do |vb|
         vb.name = "db"
         vb.cpus = 2
         vb.memory = 2048
      end
    end
  
    config.vm.define "storage" do |ubuntu|
      ubuntu.vm.box = "ubuntu/focal64"
      ubuntu.vm.hostname = "storage"
      ubuntu.vm.network "private_network", ip: "192.168.200.18"
      ubuntu.vm.provider "virtualbox" do |vb|
         vb.name = "storage"
         vb.cpus = 2
         vb.memory = 2048
         unless File.exist?('./.disk/nfs.vdi')
           vb.customize ['createmedium', 'disk', '--filename', './.disk/nfs.vdi', '--size', 10240]
         end
         vb.customize ['storageattach', :id, '--storagectl', 'SCSI', '--port', 2, '--device', 0, '--type', 'hdd', '--medium', './.disk/nfs.vdi']
         unless File.exist?('./.disk/iscsi.vdi')
           vb.customize ['createmedium', 'disk', '--filename', './.disk/iscsi.vdi', '--size', 10240]
         end
         vb.customize ['storageattach', :id, '--storagectl', 'SCSI', '--port', 3, '--device', 0, '--type', 'hdd', '--medium', './.disk/iscsi.vdi']
      end
    end
  end

 

 


(base) student@cccr:~/vagrant/wp$ vagrant reload storage
==> storage: Attempting graceful shutdown of VM...
==> storage: Checking if box 'ubuntu/focal64' version '20210624.0.0' is up to date...
==> storage: Clearing any previously set forwarded ports...
==> storage: Fixed port collision for 22 => 2222. Now on port 2203.
==> storage: Clearing any previously set network interfaces...
==> storage: Preparing network interfaces based on configuration...
    storage: Adapter 1: nat
    storage: Adapter 2: hostonly
==> storage: Forwarding ports...
    storage: 22 (guest) => 2203 (host) (adapter 1)
==> storage: Running 'pre-boot' VM customizations...
==> storage: Booting VM...
==> storage: Waiting for machine to boot. This may take a few minutes...
    storage: SSH address: 127.0.0.1:2203
    storage: SSH username: vagrant
    storage: SSH auth method: private key
==> storage: Machine booted and ready!
==> storage: Checking for guest additions in VM...
==> storage: Setting hostname...
==> storage: Configuring and enabling network interfaces...
==> storage: Mounting shared folders...
    storage: /vagrant => /home/student/vagrant/wp
==> storage: Machine already provisioned. Run `vagrant provision` or use the `--provision`
==> storage: flag to force provisioning. Provisioners marked to run always will still run.
(base) student@cccr:~/vagrant/wp$ vagrant ssh storage
Welcome to Ubuntu 20.04.2 LTS (GNU/Linux 5.4.0-77-generic x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage

  System information as of Mon Jun 28 07:44:25 UTC 2021

  System load:  0.15              Processes:               142
  Usage of /:   4.7% of 38.71GB   Users logged in:         0
  Memory usage: 12%               IPv4 address for enp0s3: 10.0.2.15
  Swap usage:   0%                IPv4 address for enp0s8: 192.168.200.18

 * Super-optimized for small spaces - read how we shrank the memory
   footprint of MicroK8s to make it the smallest full K8s around.

   https://ubuntu.com/blog/microk8s-memory-optimisation

0 updates can be applied immediately.


Last login: Mon Jun 28 06:44:57 2021 from 10.0.2.2
vagrant@storage:~$ lsblk
NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
loop0    7:0    0 55.5M  1 loop /snap/core18/2074
loop1    7:1    0 32.3M  1 loop /snap/snapd/12159
loop2    7:2    0 67.6M  1 loop /snap/lxd/20326
sda      8:0    0   40G  0 disk 
└─sda1   8:1    0   40G  0 part /
sdb      8:16   0   10M  0 disk 
sdc      8:32   0   10G  0 disk 
sdd      8:48   0   10G  0 disk 
vagrant@storage:~$ history
    1  lsblk
    2  vagrant reload storage
    3  sudo apt upgrade
    4  sudo apt install vagrant
    5  apt install vagrant
    6  sudo su - root
    7  lsblk
    8  sudo apt upgrade
    9  lsblk
   10  history
   11  lsblk
   12  sudo apt search targetcli
   13  sudo apt install targetcli-fb
   14  targetcli
   15  systemctl status targetcli
   16  sudo targetcli
   17  vagrant ssh db
   18  sudo targetcli
   19  exit
   20  lsblk
   21  history
vagrant@storage:~$ sudo targetcli
targetcli shell version 2.1.51
Copyright 2011-2013 by Datera, Inc and others.
For help on commands, type 'help'.

/> /backstores/block create dev=/dev/sdd name=db
Created block storage object db using /dev/sdd.
/> ls
o- / ..................................................................................... [...]
  o- backstores .......................................................................... [...]
  | o- block .............................................................. [Storage Objects: 1]
  | | o- db ........................................ [/dev/sdd (10.0GiB) write-thru deactivated]
  | |   o- alua ............................................................... [ALUA Groups: 1]
  | |     o- default_tg_pt_gp ................................... [ALUA state: Active/optimized]
  | o- fileio ............................................................. [Storage Objects: 0]
  | o- pscsi .............................................................. [Storage Objects: 0]
  | o- ramdisk ............................................................ [Storage Objects: 0]
  o- iscsi ........................................................................ [Targets: 0]
  o- loopback ..................................................................... [Targets: 0]
  o- vhost ........................................................................ [Targets: 0]
  o- xen-pvscsi ................................................................... [Targets: 0]
/> /iscsi create wwn=iqn.2021-06.com.cccr:storage
Created target iqn.2021-06.com.cccr:storage.
Created TPG 1.
Global pref auto_add_default_portal=true
Created default portal listening on all IPs (0.0.0.0), port 3260.
/> /iscsi/iqn.2021-06.com.cccr:storage/tpg1/acls create wwn=iqn.2021-06.com.cccr:db
Created Node ACL for iqn.2021-06.com.cccr:db
/> /iscsi/iqn.2021-06.com.cccr:storage/tpg1/luns create storage_object=/backstores/block/db lun=lun0
Created LUN 0.
Created LUN 0->0 mapping in node ACL iqn.2021-06.com.cccr:db
/>quit
> exit

vagrant@storage:~$ sudo systemctl enable rtslib-fb-targetctl

vagrant@storage:~$ sudo systemctl enable rtslib-fb-targetctl
Synchronizing state of rtslib-fb-targetctl.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable rtslib-fb-targetctl
Created symlink /etc/systemd/system/multi-user.target.wants/rtslib-fb-targetctl.service → /lib/systemd/system/rtslib-fb-targetctl.service.
vagrant@storage:~$ sudo -i
root@storage:~# exit
logout
vagrant@storage:~$ sudo -i
root@storage:~# mkdir /mnt/nfs
root@storage:~# mkfs -t ext4 /dev/sdc
mke2fs 1.45.5 (07-Jan-2020)
Creating filesystem with 2621440 4k blocks and 655360 inodes
Filesystem UUID: c9e1c5c4-4dfb-4e3b-9b2c-6a4186ce5a86
Superblock backups stored on blocks: 
	32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632

Allocating group tables: done                            
Writing inode tables: done                            
Creating journal (16384 blocks): done
Writing superblocks and filesystem accounting information: done 

root@storage:~# mount /dev/sdc -o _netdev /mnt/nfs
root@storage:~# df -h
Filesystem      Size  Used Avail Use% Mounted on
udev            977M     0  977M   0% /dev
tmpfs           199M  964K  198M   1% /run
/dev/sda1        39G  1.9G   37G   5% /
tmpfs           994M     0  994M   0% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs           994M     0  994M   0% /sys/fs/cgroup
/dev/loop0       56M   56M     0 100% /snap/core18/2074
/dev/loop1       33M   33M     0 100% /snap/snapd/12159
/dev/loop2       68M   68M     0 100% /snap/lxd/20326
vagrant         117G   43G   75G  37% /vagrant
tmpfs           199M     0  199M   0% /run/user/1000
/dev/sdc        9.8G   37M  9.3G   1% /mnt/nfs
root@storage:~# vi /etc/fstab
   /dev/sdc        /mnt/nfs         ext4    _netdev 0 0
root@storage:~# mount -a
root@storage:~# 

(base) student@cccr:~$ cd vagrant
(base) student@cccr:~/vagrant$ cd wp
(base) student@cccr:~/vagrant/wp$ vagrant ssh db
Welcome to Ubuntu 20.04.2 LTS (GNU/Linux 5.4.0-77-generic x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage

  System information as of Mon Jun 28 07:24:11 UTC 2021

  System load:  0.0               Processes:               114
  Usage of /:   3.6% of 38.71GB   Users logged in:         0
  Memory usage: 10%               IPv4 address for enp0s3: 10.0.2.15
  Swap usage:   0%                IPv4 address for enp0s8: 192.168.200.15

 * Super-optimized for small spaces - read how we shrank the memory
   footprint of MicroK8s to make it the smallest full K8s around.

   https://ubuntu.com/blog/microk8s-memory-optimisation

1 update can be applied immediately.
To see these additional updates run: apt list --upgradable


vagrant@db:~$ cd /etc/iscsi
vagrant@db:/etc/iscsi$ sudo cat i
cat: i: No such file or directory
vagrant@db:/etc/iscsi$ audo apy search open-iscsi

Command 'audo' not found, did you mean:

  command 'aldo' from deb aldo (0.7.7-1build2)
  command 'udo' from deb udo (6.4.1-5)
  command 'sudo' from deb sudo (1.8.31-1ubuntu1.2)
  command 'sudo' from deb sudo-ldap (1.8.31-1ubuntu1.2)

Try: apt install <deb name>

vagrant@db:/etc/iscsi$ sudo apt search open-iscsi
Sorting... Done
Full Text Search... Done
iscsiuio/focal-updates 2.0.874-7.1ubuntu6.2 amd64
  iSCSI offloading daemon for QLogic devices

open-iscsi/focal-updates,now 2.0.874-7.1ubuntu6.2 amd64 [installed,automatic]
  iSCSI initiator tools

vagrant@db:/etc/iscsi$ ls
initiatorname.iscsi  iscsid.conf

vagrant@db:/etc/iscsi$ sudo vi initiatorname.iscsi 

vagrant@db:/etc/iscsi$ sudo cat initiatorname.iscsi 
InitiatorName=iqn.2021-06.com.cccr:db

vagrant@db:/etc/iscsi$ sudo iscsiadm -m discovery -t st -p 192.168.200.18
192.168.200.18:3260,1 iqn.2021-06.com.cccr:storage

vagrant@db:/etc/iscsi$ sudo iscsiadm -m node -T iqn.2021-06.com.cccr:storage -l
Logging in to [iface: default, target: iqn.2021-06.com.cccr:storage, portal: 192.168.200.18,3260] (multiple)
Login to [iface: default, target: iqn.2021-06.com.cccr:storage, portal: 192.168.200.18,3260] successful.

vagrant@db:/etc/iscsi$ lsblk
NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
loop0    7:0    0 55.5M  1 loop /snap/core18/2074
loop1    7:1    0 67.6M  1 loop /snap/lxd/20326
loop2    7:2    0 32.3M  1 loop /snap/snapd/12159
sda      8:0    0   40G  0 disk 
└─sda1   8:1    0   40G  0 part /
sdb      8:16   0   10M  0 disk 
sdc      8:32   0   10G  0 disk 
vagrant@db:/etc/iscsi$ 

https://honglab.tistory.com/

'Docker' 카테고리의 다른 글

도커 볼륨  (0) 2021.07.01
컨테이너 실행  (0) 2021.07.01
7/1 컨테이너 실행  (0) 2021.07.01
7/1 Docker 이미지 다운로드/업로드  (0) 2021.07.01
6/30 컨테이너  (0) 2021.06.30
Contents

포스팅 주소를 복사했습니다

이 글이 도움이 되었다면 공감 부탁드립니다.