OpenStack Antelope : Trove उपयोग कैसे करें2023/09/11 |
Trove का उपयोग इस प्रकार करें।
यह उदाहरण निम्न प्रकार से पर्यावरण पर आधारित है।
------------+--------------------------+--------------------------+------------ | | | eth0|10.0.0.30 eth0|10.0.0.50 eth0|10.0.0.51 +-----------+-----------+ +-----------+-----------+ +-----------+-----------+ | [ dlp.srv.world ] | | [ network.srv.world ] | | [ node01.srv.world ] | | (Control Node) | | (Network Node) | | (Compute Node) | | | | | | | | MariaDB RabbitMQ | | Open vSwitch | | Libvirt | | Memcached Nginx | | Neutron Server | | Nova Compute | | Keystone httpd | | OVN-Northd | | Open vSwitch | | Glance Nova API | | Nginx iSCSI Target | | OVN Metadata Agent | | Cinder API | | Cinder Volume | | OVN-Controller | | | | Trove Services | | | +-----------------------+ +-----------------------+ +-----------------------+ |
[1] | ट्रोव के लिए एक VM छवि डाउनलोड करें और इसे Glance में जोड़ें। [trove.conf] में कॉन्फ़िगर किया गया Cinder वॉल्यूम प्रकार भी बनाएं। |
root@dlp ~(keystone)# wget https://tarballs.opendev.org/openstack/trove/images/trove-master-guest-ubuntu-focal.qcow2
root@dlp ~(keystone)#
root@dlp ~(keystone)# openstack image create Trove-Ubuntu --file=trove-master-guest-ubuntu-focal.qcow2 --disk-format=qcow2 --container-format=bare --tag=trove --private
openstack image list +--------------------------------------+--------------+--------+ | ID | Name | Status | +--------------------------------------+--------------+--------+ | de2d8750-dbd6-4b97-aa28-a920a2309718 | Trove-Ubuntu | active | | 00ea6e97-0e97-4cb4-8ac4-2409c28f0289 | Ubuntu2204 | active | +--------------------------------------+--------------+--------+[root@dlp ~(keystone)]# openstack volume type create lvm-trove --private +-------------+--------------------------------------+ | Field | Value | +-------------+--------------------------------------+ | description | None | | id | c0913e9c-285a-42e9-93a9-32d68b50c866 | | is_public | False | | name | lvm-trove | +-------------+--------------------------------------+ |
[2] | वह डेटास्टोर जोड़ें जिसका उपयोग आप उस नोड पर करना चाहते हैं जो Trove API चल रहा है। (यह इस उदाहरण पर नेटवर्क नोड है) उदाहरण के लिए, यहां MariaDB, MySQL जोड़ें। |
# डेटास्टोर जोड़ें root@network:~# su -s /bin/bash trove -c "trove-manage datastore_update mariadb ''" Datastore 'mariadb' updated. root@network:~# su -s /bin/bash trove -c "trove-manage datastore_update mysql ''" Datastore 'mysql' updated. # प्रत्येक डेटास्टोर के लिए संस्करण जोड़ें # [de2d8750-***] के लिए, यह Trove की छवि आईडी है जिसे आपने [2] में बनाया है root@network:~# su -s /bin/sh -c "trove-manage datastore_version_update mariadb 10.3 mariadb de2d8750-dbd6-4b97-aa28-a920a2309718 mariadb 1" trove Datastore version '10.3(10.3)' updated. root@network:~# su -s /bin/sh -c "trove-manage datastore_version_update mariadb 10.5 mariadb de2d8750-dbd6-4b97-aa28-a920a2309718 mariadb 1" trove Datastore version '10.5(10.5)' updated. root@network:~# su -s /bin/sh -c "trove-manage datastore_version_update mysql 8.0 mysql de2d8750-dbd6-4b97-aa28-a920a2309718 mysql 1" trove Datastore version '8.0(8.0)' updated. # डेटास्टोर के प्रत्येक संस्करण के लिए पैरामीटर जोड़ें root@network:~# su -s /bin/bash trove -c "trove-manage db_load_datastore_config_parameters mariadb 10.3 /usr/lib/python3/dist-packages/trove/templates/mariadb/validation-rules.json" Loading config parameters for datastore (mariadb) version (10.3) root@network:~# su -s /bin/bash trove -c "trove-manage db_load_datastore_config_parameters mariadb 10.5 /usr/lib/python3/dist-packages/trove/templates/mariadb/validation-rules.json" Loading config parameters for datastore (mariadb) version (10.5) root@network:~# su -s /bin/bash trove -c "trove-manage db_load_datastore_config_parameters mysql 8.0 /usr/lib/python3/dist-packages/trove/templates/mysql/validation-rules.json" Loading config parameters for datastore (mysql) version (8.0) # VM छवि के लिए [cloudinit] फ़ाइलें बनाएं root@network:~# mkdir /etc/trove/cloudinit
root@network:~#
vi /etc/trove/cloudinit/mariadb.cloudinit # नया निर्माण # [CONTROLLER] के लिए Trove API होस्ट निर्दिष्ट करें #cloud-config runcmd: - echo 'CONTROLLER=network.srv.world' > /etc/trove/controller.conf - chmod 644 /etc/trove/controller.conf cp /etc/trove/cloudinit/mariadb.cloudinit /etc/trove/cloudinit/mysql.cloudinit root@network:~# chown -R trove /etc/trove/cloudinit |
[3] | किसी भी Openstack उपयोगकर्ता के रूप में लॉगिन करें और नोड पर एक डेटाबेस इंस्टेंस बनाएं। वैसे, डेटाबेस इंस्टेंस VM इंस्टेंस के अंदर डॉकर कंटेनर के रूप में चलता है। |
ubuntu@dlp ~(keystone)$ openstack datastore list +--------------------------------------+------------+ | ID | Name | +--------------------------------------+------------+ | 6efdd4f6-9532-4f61-8ff8-c90c5c351e1e | mariadb | | fa217b97-6598-4586-8200-14f899689c0b | mysql | +--------------------------------------+------------+ubuntu@dlp ~(keystone)$ openstack datastore version list mariadb +--------------------------------------+------+---------+ | ID | Name | Version | +--------------------------------------+------+---------+ | e6e070a8-39e8-4366-8126-163399b573b7 | 10.3 | 10.3 | | 0c2c0c0d-e0a4-444b-91d5-1c002a7dc75d | 10.5 | 10.5 | +--------------------------------------+------+---------+ubuntu@dlp ~(keystone)$ openstack flavor list +----+-----------+------+------+-----------+-------+-----------+ | ID | Name | RAM | Disk | Ephemeral | VCPUs | Is Public | +----+-----------+------+------+-----------+-------+-----------+ | 1 | m1.small | 2048 | 10 | 0 | 1 | True | | 2 | m1.medium | 4096 | 10 | 0 | 2 | True | | 3 | m1.large | 8192 | 20 | 10 | 4 | True | +----+-----------+------+------+-----------+-------+-----------+ubuntu@dlp ~(keystone)$ openstack network list +--------------------------------------+---------+--------------------------------------+ | ID | Name | Subnets | +--------------------------------------+---------+--------------------------------------+ | 5352e6c0-47b3-4df2-84f4-ca048f141e1d | public | ca5539a8-0291-4684-9fb3-0f448efacebf | | ce6e88bc-107a-446b-b2ab-255bab7269fe | private | feb337ec-215e-406e-8871-196fed2c4207 | +--------------------------------------+---------+--------------------------------------+ # डेटाबेस उदाहरण बनाएँ ubuntu@dlp ~(keystone)$ openstack database instance create MariaDB-105 \ --flavor 2 \ --size 10 \ --nic net-id=ce6e88bc-107a-446b-b2ab-255bab7269fe \ --databases MyDB --users serverworld:password \ --datastore mariadb --datastore-version 10.5 \ --is-public \ --allowed-cidr 10.0.0.0/24 \ --allowed-cidr 192.168.100.0/24 +--------------------------+--------------------------------------+ | Field | Value | +--------------------------+--------------------------------------+ | allowed_cidrs | ['10.0.0.0/24', '192.168.100.0/24'] | | created | 2023-03-29T06:03:27 | | datastore | mariadb | | datastore_version | 10.5 | | datastore_version_number | 10.5 | | flavor | 2 | | id | efc1853a-a72d-4194-b6a0-bf89155d6a91 | | name | MariaDB-105 | | operating_status | | | public | True | | region | RegionOne | | service_status_updated | 2023-03-29T06:03:27 | | status | BUILD | | updated | 2023-03-29T06:03:27 | | volume | 10 | +--------------------------+--------------------------------------+ # [BUILD] निर्माण के दौरान स्थिति ubuntu@dlp ~(keystone)$ openstack database instance list +--------------------------------------+-------------+-----------+-------------------+--------+------------------+--------+-----------+-----------+------+------+ | ID | Name | Datastore | Datastore Version | Status | Operating Status | Public | Addresses | Flavor ID | Size | Role | +--------------------------------------+-------------+-----------+-------------------+--------+------------------+--------+-----------+-----------+------+------+ | efc1853a-a72d-4194-b6a0-bf89155d6a91 | MariaDB-105 | mariadb | 10.5 | BUILD | | True | | 2 | 10 | | +--------------------------------------+-------------+-----------+-------------------+--------+------------------+--------+-----------+-----------+------+------+ # यदि सफलतापूर्वक बनाया गया है, तो स्थिति [HEALTHY] में बदल जाती है ubuntu@dlp ~(keystone)$ openstack database instance list +--------------------------------------+-------------+-----------+-------------------+--------+------------------+-------- | ID | Name | Datastore | Datastore Version | Status | Operating Status | Public +--------------------------------------+-------------+-----------+-------------------+--------+------------------+-------- | efc1853a-a72d-4194-b6a0-bf89155d6a91 | MariaDB-105 | mariadb | 10.5 | ACTIVE | HEALTHY | True +--------------------------------------+-------------+-----------+-------------------+--------+------------------+-------- +----------------------------------------------------------------------------------------------------------------------------------------------------- | Addresses +----------------------------------------------------------------------------------------------------------------------------------------------------- | [{'address': '192.168.100.112', 'type': 'private', 'network': 'ce6e88bc-107a-446b-b2ab-255bab7269fe'}, {'address': '10.0.0.246', 'type': 'public'}] +----------------------------------------------------------------------------------------------------------------------------------------------------- +-----------+------+------+ | Flavor ID | Size | Role | +-----------+------+------+ | 2 | 10 | | +-----------+------+------+ # पहुंच सत्यापित करें ubuntu@dlp ~(keystone)$ mysql -h 10.0.0.246 -u serverworld -p -e "show variables like 'hostname'; show databases;" Enter password: +---------------+--------------+ | Variable_name | Value | +---------------+--------------+ | hostname | 0803075444c4 | +---------------+--------------+ +--------------------+ | Database | +--------------------+ | MyDB | | information_schema | +--------------------+ # किसी डेटाबेस इंस्टेंस को हटाने के लिए, निम्न कार्य करें ubuntu@dlp ~(keystone)$ openstack database instance delete MariaDB-105 Request to delete database instance efc1853a-a72d-4194-b6a0-bf89155d6a91 has been accepted. |
[4] | यह MySQL इंस्टेंस बनाने के मामले के लिए है। |
ubuntu@dlp ~(keystone)$ openstack datastore list +--------------------------------------+------------+ | ID | Name | +--------------------------------------+------------+ | 6efdd4f6-9532-4f61-8ff8-c90c5c351e1e | mariadb | | fa217b97-6598-4586-8200-14f899689c0b | mysql | +--------------------------------------+------------+ubuntu@dlp ~(keystone)$ openstack datastore version list mysql
+--------------------------------------+------+---------+
| ID | Name | Version |
+--------------------------------------+------+---------+
| cb2f2cbf-5813-4a60-a2fa-bf075ee97b7b | 8.0 | 8.0 |
+--------------------------------------+------+---------+
ubuntu@dlp ~(keystone)$ openstack database instance create MySQL-8 \
--flavor 2 \
--size 10 \
--nic net-id=ce6e88bc-107a-446b-b2ab-255bab7269fe \
--databases MyDB --users serverworld:password \
--datastore mysql --datastore-version 8.0 \
--is-public \
--allowed-cidr 10.0.0.0/24 \
--allowed-cidr 192.168.100.0/24
ubuntu@dlp ~(keystone)$ openstack database instance list +--------------------------------------+---------+-----------+-------------------+--------+------------------+-------- | ID | Name | Datastore | Datastore Version | Status | Operating Status | Public +--------------------------------------+---------+-----------+-------------------+--------+------------------+-------- | c8a2a186-1cbe-4d2a-88a5-90b634dbf522 | MySQL-8 | mysql | 8.0 | ACTIVE | HEALTHY | True +--------------------------------------+---------+-----------+-------------------+--------+------------------+-------- +----------------------------------------------------------------------------------------------------------------------------------------------------- | Addresses +----------------------------------------------------------------------------------------------------------------------------------------------------- | [{'address': '192.168.100.150', 'type': 'private', 'network': 'ce6e88bc-107a-446b-b2ab-255bab7269fe'}, {'address': '10.0.0.216', 'type': 'public'}] +----------------------------------------------------------------------------------------------------------------------------------------------------- +-----------+------+------+ | Flavor ID | Size | Role | +-----------+------+------+ | 2 | 10 | | +-----------+------+------+ubuntu@dlp ~(keystone)$ mysql -h 10.0.0.216 -u serverworld -p -e "show variables like 'hostname'; show databases;" Enter password: +---------------+--------------+ | Variable_name | Value | +---------------+--------------+ | hostname | 87e615253fcb | +---------------+--------------+ +--------------------+ | Database | +--------------------+ | MyDB | | information_schema | | performance_schema | +--------------------+ |
Sponsored Link |