Jboss Data Grid Jboss EAP Infinispan lxd demo

something

Posted by datahawklab on July 9, 2021

add the Ubuntu minimal cloud repo

1
lxc remote add --protocol simplestreams ubuntu-minimal https://cloud-images.ubuntu.com/minimal/releases/

LXC/LXD Virtualization containers

1
2
3
4
lxc config set servidc raw.idmap "both 1000 1000"
cat cloud-config2.yaml | lxc profile edit cloud-config
lxc launch ubuntu-minimal:focal -p cloud-config -p default test
lxc file push /tmp/authorized_keys ros1-live/home/ubuntu/.ssh/authorized_keys -p
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
config:
  limits.cpu: "2"
  limits.memory: 4GB
  user.vendor-data: |
    #cloud-config
    package_update: true
    ssh_pwauth: yes
    packages:
      - openssh-server
      - zip
      - unzip
      - curl
      - wget
    users:
     - name: "ubuntu"
       passwd: "<shell password hash>"
       lock_passwd: false
       groups: lxd
       shell: /bin/bash
       sudo: ALL=(ALL) NOPASSWD:ALL
       ssh-import-id: <lp username>
description: ""
devices:
  config:
    source: cloud-init:config
    type: disk
  eth0:
    name: eth0
    nictype: bridged
    parent: lxdbr0
    type: nic
  work:
    path: /mountf
    source: /home/servidc/mountf
    type: disk

launh a cloud init minimal container as a vm/container

1
lxc launch ubuntu-minimal:20.04 infinispan-test-1 -p cloud-profile1

tainer creation timing

note that below shows that 6 containers were built and running in 75 seconds

1
2
3
4
5
6
7
export start=$(date +%s) ;\
lxc launch ubuntu-minimal:20.04 infinispan-test-2 -p cloud-profile1 && \
lxc launch ubuntu-minimal:20.04 infinispan-test-2 -p cloud-profile1 && \
lxc launch ubuntu-minimal:20.04 infinispan-test-3 -p cloud-profile1 && \
lxc launch ubuntu-minimal:20.04 infinispan-test-4 -p cloud-profile1 && \
lxc launch ubuntu-minimal:20.04 infinispan-test-5 -p cloud-profile1 && \
lxc launch ubuntu-minimal:20.04 infinispan-test-6 -p cloud-profile1 && \

creation results and timing

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
Creating infinispan-test-1
Starting infinispan-test-1
Creating infinispan-test-2     
Starting infinispan-test-2
Creating infinispan-test-3     
Starting infinispan-test-3
Creating infinispan-test-4     
Starting infinispan-test-4
Creating infinispan-test-5     
Starting infinispan-test-5
Creating infinispan-test-6     
Starting infinispan-test-6

Elapsed time: 75 seconds    


❯ lxc list
+-------------------+---------+----------------------+-----------------------------------------------+-----------+-----------+
|       NAME        |  STATE  |         IPV4         |                     IPV6                      |   TYPE    | SNAPSHOTS |
+-------------------+---------+----------------------+-----------------------------------------------+-----------+-----------+
| infinispan-test-1 | RUNNING | 10.228.91.126 (eth0) | fd42:e907:6f3b:8148:216:3eff:fe13:e82e (eth0) | CONTAINER | 0         |
+-------------------+---------+----------------------+-----------------------------------------------+-----------+-----------+
| infinispan-test-2 | RUNNING | 10.228.91.130 (eth0) | fd42:e907:6f3b:8148:216:3eff:fef7:3f89 (eth0) | CONTAINER | 0         |
+-------------------+---------+----------------------+-----------------------------------------------+-----------+-----------+
| infinispan-test-3 | RUNNING | 10.228.91.84 (eth0)  | fd42:e907:6f3b:8148:216:3eff:fe6b:bd4b (eth0) | CONTAINER | 0         |
+-------------------+---------+----------------------+-----------------------------------------------+-----------+-----------+
| infinispan-test-4 | RUNNING | 10.228.91.208 (eth0) | fd42:e907:6f3b:8148:216:3eff:fe09:6fa2 (eth0) | CONTAINER | 0         |
+-------------------+---------+----------------------+-----------------------------------------------+-----------+-----------+
| infinispan-test-5 | RUNNING | 10.228.91.38 (eth0)  | fd42:e907:6f3b:8148:216:3eff:fe38:fb23 (eth0) | CONTAINER | 0         |
+-------------------+---------+----------------------+-----------------------------------------------+-----------+-----------+
| infinispan-test-6 | RUNNING | 10.228.91.3 (eth0)   | fd42:e907:6f3b:8148:216:3eff:feff:8fe7 (eth0) | CONTAINER | 0         |
+-------------------+---------+-
1
2
3
4
5
6
7
cat /etc/{subuid,subgid}
servidc:100000:65536
servidc:100000:65536

on host:
id
uid=1000(servidc) gid=1001(servidc) groups=1001(servidc),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),119(lpadmin),129(lxd),133(libvirt),1000(sambashare)

setup alias for non-root user on host

1
2
3
4
5
6
7
lxc launch ubuntu-minimal:20.04 domain-master &&\
lxc launch ubuntu-minimal:20.04 eap-cache-container1 &&\
lxc launch ubuntu-minimal:20.04 eap-cache-container2 &&\
lxc launch ubuntu-minimal:20.04 eap-cache-container3 &&\
lxc launch ubuntu-minimal:20.04 eap-app-container1 &&\
lxc launch ubuntu-minimal:20.04 eap-app-container2 &&\
lxc launch ubuntu-minimal:20.04 eap-app-container3

lxc config device add domain-master downloads disk source=$HOME/Downloads path=/Downloads &&
lxc config device add eap-cache-container1 downloads disk source=$HOME/Downloads path=/Downloads &&
lxc config device add eap-cache-container2 downloads disk source=$HOME/Downloads path=/Downloads &&
lxc config device add eap-cache-container3 downloads disk source=$HOME/Downloads path=/Downloads &&
lxc config device add eap-app-container1 downloads disk source=$HOME/Downloads path=/Downloads &&
lxc config device add eap-app-container2 downloads disk source=$HOME/Downloads path=/Downloads &&
lxc config device add eap-app-container3 downloads disk source=$HOME/Downloads path=/Downloads

lxc exec domain-master bash apt-get update -y &&
apt-get install git curl unzip zip -y &&
useradd -d /home/servid -m -s /bin/bash -c “service id” servid &&
echo -e “tublu1224\ntublu1224” | passwd servid &&
exit