首页
归档
时光轴
推荐
Cloud
图床
导航
Search
1
Deploy OpenStack offline based on Kolla
737 阅读
2
openstact 基础环境安装 (手动版)
687 阅读
3
Mariadb 主从复制&读写分离
642 阅读
4
Typecho 1.2.0 部署
640 阅读
5
FusionCompute8.0 体验
573 阅读
Python
Linux
随笔
mysql
openstack
Search
标签搜索
linux
Pike
python
爬虫
openstack
mysql
Essay
Ansible
docker
Zabbix
kolla
Internet
Redis
1+X
Hyper-V
jenkins
Kickstart
自动化
sh
pxe
Acha
累计撰写
77
篇文章
累计收到
1
条评论
首页
栏目
Python
Linux
随笔
mysql
openstack
页面
归档
时光轴
推荐
Cloud
图床
导航
搜索到
77
篇与
的结果
2023-05-06
准备 kolla 离线部署包
分析需要的文件 RPM包 容器镜像 pip 包 流程 1、配置完yum源,设置开启缓存。手动部署完,制作 repo 源 2、手动部署完,将所有容器打包 3、手动部署完,统计 python模块包 写到 requirements.txt,下载收集并编写安装脚本。 容器镜像 全部导出 docker save `docker images --format "{{.Repository}}:{{.Tag}}"` | gzip > kolla_centos_train_min.tar.gz 导入 docker load -i kolla_centos_train_min.tar.gz rpm 软件包 [root@kolla ~]# mkdir /repo [root@kolla ~]# cat /etc/yum.conf [main] cachedir=/repo keepcache=1 ... [root@kolla ~]# yum install -y createrepo [root@kolla ~]# cd /repo [root@kolla repo]# mkdir -p kolla_centos_train_rpm/Packages [root@kolla repo]# cp -ra */packages/* kolla_centos_train_rpm/Packages [root@kolla repo]# cd kolla_centos_train_rpm [root@kolla kolla_centos_train_rpm]# createrepo ./ [root@kolla kolla_centos_train_rpm]# ls Packages repodata [root@kolla kolla_centos_train_rpm]# cd /repo [root@kolla repo]# tar cfz kolla_centos_train_rpm.tar.gz kolla_centos_train_rpm pip 依赖包 [root@kolla kolla_centos_train_whl]# cat requirements.txt setuptools==22.0.5 pip==20.3.4 wheel kolla-ansible==9.1.0 [root@kolla kolla_centos_train_whl]# mkdir packages [root@kolla kolla_centos_train_whl]# pip download -d packages -r requirements.txt [root@kolla kolla_centos_train_whl]# cat install.sh #!/bin/bash pip install --no-index --find-links=./packages/ setuptools==22.0.5 pip install --no-index --find-links=./packages/ pip==20.3.4 pip install --no-index --find-links=./packages/ wheel pip install --no-index --find-links=./packages/ kolla-ansible==9.1.0 --ignore-installed PyYAML [root@kolla ~]# tar cfz kolla_centos_train_whl.tar.gz kolla_centos_train_whl/
2023年05月06日
328 阅读
0 评论
0 点赞
2023-05-06
Deploy OpenStack offline based on Kolla
Deploy OpenStack offline based on Kolla 系统:CentOS Linux release 7.9.2009 (Core) 规格:4C8G 存储 50G 系统盘 20G 数据盘(cinder) 网络规划 ens33 仅主机(管理网、ip:192.168.100.10/24) ens34 NAT(业务网、CICR:192.168.10.0/24 、gw:192.168.10.2) VIP 192.168.100.100 初始化环境 1、修改主机名 hosts [root@kolla ~]# hostnamectl set-hostname kolla rabbitmq 可能需要能够进行主机名解析 2、配置网络 [root@kolla ~]# cat > /etc/sysconfig/network-scripts/ifcfg-ens34 <<EOF NAME=ens34 DEVICE=ens34 TYPE=Ethernet ONBOOT="yes" BOOTPROTO="none" EOF [root@kolla ~]# nmcli con reload && nmcli con up ens34 准备两块网卡、ens34 为 业务网络 3、上传软件包 99cloud_skyline.tar.gz // skyline 容器镜像 kolla_centos_train_min.tar.gz // 容器镜像(最小化) kolla_centos_train_rpm.tar.gz // 依赖软件包 kolla_centos_train_whl.tar.gz // pip依赖包 4、创建 lvm [root@kolla ~]# pvcreate /dev/sdb [root@kolla ~]# vgcreate cinder-volumes /dev/sdb 注:卷组名为 cinder_volume_group 参数 5、配置 源 配置 yum [root@kolla ~]# mkdir /etc/yum.repos.d/bak [root@kolla ~]# mv /etc/yum.repos.d/*.repo /etc/yum.repos.d/bak [root@kolla ~]# tar xf kolla_centos_train_rpm.tar.gz -C /opt/ [root@kolla ~]# cat > /etc/yum.repos.d/local.repo << EOF [kolla] name=kolla - acha baseurl=file:///opt/kolla_centos_train_rpm/ gpgcheck=0 enabled=1 EOF 安装 依赖 [root@kolla ~]# yum install -y python-devel libffi-devel gcc openssl-devel \ libselinux-python python2-pip python-pbr ansible 安装常用软件 [root@kolla ~]# yum install -y vim unzip net-tools lrzsz tree bash-completion 部署环境 1、安装 kolla-ansible [root@kolla ~]# tar xf kolla_centos_train_whl.tar.gz [root@kolla ~]# cd kolla_centos_train_whl [root@kolla kolla_centos_train_whl]# ./install.sh 2、配置 准备配置文件 [root@kolla kolla_centos_train_whl]# mkdir -p /etc/kolla [root@kolla kolla_centos_train_whl]# cd /etc/kolla [root@kolla kolla]# chown $USER:$USER /etc/kolla [root@kolla kolla]# cp -r /usr/share/kolla-ansible/etc_examples/kolla/* /etc/kolla [root@kolla kolla]# cp /usr/share/kolla-ansible/ansible/inventory/* /etc/kolla 修改ansible配置文件 [root@kolla kolla]# cat << EOF | sed -i '/^\[defaults\]$/ r /dev/stdin' /etc/ansible/ansible.cfg host_key_checking=False pipelining=True forks=100 EOF 忽略 DeprecationWarning 提示 cat -n /usr/lib/python2.7/site-packages/ansible/parsing/vault/__init__.py | tail -n +41 | head -n 5 41 try: 42 #with warnings.catch_warnings(): 43 # warnings.simplefilter("ignore", DeprecationWarning) 44 warnings.filterwarnings("ignore") 45 from cryptography.exceptions import InvalidSignature 检查inventory [root@kolla /etc/kolla]# ansible -i all-in-one all -m ping 生成密码 [root@kolla kolla]# kolla-genpwd 修改 keystone_admin_password [root@kolla kolla]# sed -i 's#keystone_admin_password:.*#keystone_admin_password: kolla#g' /etc/kolla/passwords.yml [root@kolla kolla]# cat /etc/kolla/passwords.yml | grep keystone_admin_password keystone_admin_password: kolla 修改全局配置文件globals.yml(控制安装、配置组件) [root@kolla kolla]# cp /etc/kolla/globals.yml{,.bak} [root@kolla kolla]# cat >> /etc/kolla/globals.yml <<EOF # Kolla options kolla_base_distro: "centos" kolla_install_type: "binary" openstack_release: "train" kolla_internal_vip_address: "192.168.100.100" # Neutron - Networking Options network_interface: "ens33" neutron_external_interface: "ens34" neutron_plugin_agent: "openvswitch" enable_neutron_provider_networks: "yes" # OpenStack services enable_cinder: "yes" enable_cinder_backend_lvm: "yes" EOF 参数 说明 kolla_base_distro 容器镜像的 linux 发行版(ubuntu、centos、debain) kolla_install_type 组件构建类型(binary、source) openstack_release openstack 版本(train) kolla_internal_vip_address 高可用VIP(管理网地址) docker_registry Docker 镜像仓库 docker_namespace 镜像仓库所在命名空间(dockerhub 为 kolla) network_interface 管理网卡 neutron_external_interface 业务网卡 neutron_plugin_agent 网络插件(openvswitch,linuxbridge) enable_neutron_provider_networks 启用业务网络 enable_cinder 启用 cinder enable_cinder_backend_lvm 指定 cinder 后端存储(lvm) 3、部署 # 不启用 docker 源 [root@kolla kolla]# sed -i.bak "s/enable_docker_repo: true/enable_docker_repo: false/g" \ /usr/share/kolla-ansible/ansible/roles/baremetal/defaults/main.yml 忽略 docker版本 sed -i "9a \ \ ignore_errors: yes" \ /usr/share/kolla-ansible/ansible/roles/prechecks/tasks/service_checks.yml # 预配置,安装docker、docker sdk、关闭防火墙、配置时间同步等 [root@kolla kolla]# kolla-ansible -i ./all-in-one bootstrap-servers # 部署前检查环境 [root@kolla kolla]# kolla-ansible -i ./all-in-one prechecks # 导入镜像 [root@kolla kolla]# docker load -i /root/kolla_centos_train_min.tar.gz # 执行实际部署,运行对应组件容器 [root@kolla kolla]# kolla-ansible -i ./all-in-one deploy # 生成openrc文件 [root@kolla kolla]# kolla-ansible post-deploy 4、检查 [root@kolla kolla]# docker ps -a | grep -v Up [root@kolla kolla]# docker ps -a | wc -l 38 个容器 [root@kolla kolla]# lvs | grep cinder 安装 OpenStack 客户端 安装openstack客户端 [root@kolla kolla]# yum install -y python-openstackclient 运行 cirros 实例 [root@kolla kolla]# mkdir -p /opt/cache/files/ [root@kolla kolla]# mv cirros-0.4.0-x86_64-disk.img /opt/cache/files/ # 定义init-runonce示例脚本外部网络配置 [root@kolla kolla]# vim /usr/share/kolla-ansible/init-runonce EXT_NET_CIDR=${EXT_NET_CIDR:-'192.168.10.0/24'} EXT_NET_RANGE=${EXT_NET_RANGE:-'start=192.168.10.50,end=192.168.10.200'} EXT_NET_GATEWAY=${EXT_NET_GATEWAY:-'192.168.10.2'} # 执行脚本,上传镜像到glance,创建内部网络、外部网络、flavor、ssh key,并运行一个实例 [root@kolla kolla]# source /etc/kolla/admin-openrc.sh [root@kolla kolla]# /usr/share/kolla-ansible/init-runonce [root@kolla kolla]# openstack server create \ --image cirros \ --flavor m1.tiny \ --key-name mykey \ --network demo-net \ demo1 部署 Skyline [root@kolla ~]# database_password=`awk '/^database_password/ {print $2}' /etc/kolla/passwords.yml` [root@kolla ~]# docker exec -it mariadb mysql -uroot -p$database_password \ -e "CREATE DATABASE skyline DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci; GRANT ALL PRIVILEGES ON skyline.* TO 'skyline'@'%' IDENTIFIED BY '000000';" [root@kolla ~]# docker exec -it mariadb mysql -uroot -p$database_password -e "show databases" | grep skyline [root@kolla ~]# docker exec -it mariadb mysql -uroot -p$database_password -e "select user,host from mysql.user;" | grep skyline [root@kolla ~]# source /etc/kolla/admin-openrc.sh [root@kolla ~]# openstack user create --domain default --password 000000 skyline +---------------------+----------------------------------+ | Field | Value | +---------------------+----------------------------------+ | domain_id | default | | enabled | True | | id | f437975f5b3e424382e4ac939274a92b | | name | skyline | | options | {} | | password_expires_at | None | +---------------------+----------------------------------+ [root@kolla ~]# openstack role add --project service --user skyline admin [root@kolla ~]# mkdir -p /etc/skyline /var/log/skyline /var/lib/skyline [root@kolla ~]# cat > /etc/skyline/skyline.yaml <<EOF default: database_url: 'mysql://skyline:000000@192.168.100.100:3306/skyline' prometheus_endpoint: 'http://localhost:9091' openstack: keystone_url: 'http://192.168.100.100:5000/v3' default_region: RegionOne interface_type: public system_user_name: 'skyline' system_user_password: '000000' EOF [root@kolla ~]# docker load -i /root/99cloud_skyline.tar.gz [root@kolla ~]# docker run -d --name skyline_bootstrap -e KOLLA_BOOTSTRAP="" \ -v /etc/skyline/skyline.yaml:/etc/skyline/skyline.yaml \ --net=host 99cloud/skyline:latest [root@kolla ~]# docker logs skyline_bootstrap + echo '/usr/local/bin/gunicorn -c /etc/skyline/gunicorn.py skyline_apiserver.main:app' + mapfile -t CMD ++ tail /run_command ++ xargs -n 1 + [[ -n 0 ]] + cd /skyline/libs/skyline-apiserver/ + make db_sync poetry run alembic upgrade head Skipping virtualenv creation, as specified in config file. /usr/local/lib/python3.8/dist-packages/pymysql/cursors.py:170: Warning: (1280, "Name 'alembic_version_pkc' ignored for PRIMARY key.") result = self._query(query) + exit 0 [root@kolla ~]# docker rm -f skyline_bootstrap [root@kolla ~]# docker run -d --name skyline \ --restart=always \ -v /etc/skyline/skyline.yaml:/etc/skyline/skyline.yaml \ --net=host \ 99cloud/skyline:latest
2023年05月06日
737 阅读
0 评论
0 点赞
2022-11-21
Jenkins 迁移
Jenkins 迁移 [root@jenkins ~]# rpm -ql jenkins /etc/init.d/jenkins /etc/logrotate.d/jenkins /etc/sysconfig/jenkins /usr/bin/jenkins /usr/lib/systemd/system/jenkins.service /usr/sbin/rcjenkins /usr/share/java/jenkins.war /usr/share/jenkins /usr/share/jenkins/migrate /var/cache/jenkins /var/lib/jenkins /var/log/jenkins 备份 1、停止 jenkins [root@jenkins ~]# systemctl stop jenkins [root@jenkins ~]# ps -ef | grep jenkins root 1818 1679 0 10:40 pts/0 00:00:00 grep --color=auto jenkins 2、备份 [root@jenkins ~]# grep ^JENKINS_HOME /etc/sysconfig/jenkins JENKINS_HOME="/var/lib/jenkins" [root@jenkins ~]# cd /var/lib [root@jenkins lib]# tar cfz jenkins_home.tar.gz jenkins [root@jenkins lib]# du -sh jenkins_home.tar.gz 182M jenkins_home.tar.gz [root@jenkins lib]# mv jenkins_home.tar.gz /root/ [root@jenkins ~]# cp -a /usr/lib/systemd/system/jenkins.service . [root@jenkins ~]# cp -a /etc/sysconfig/jenkins . [root@jenkins ~]# tar cfz jenkins_backup.tar.gz jenkins* [root@jenkins ~]# ll total 553540 -rw-------. 1 root root 1456 Nov 8 09:06 anaconda-ks.cfg -rwxr-xr-x. 1 root root 1012 Nov 8 09:14 init.sh -rw-------. 1 root root 4034 Nov 8 09:19 jenkins -rw-r--r--. 1 root root 93270402 Nov 2 07:55 jenkins-2.376-1.1.noarch.rpm -rw-r--r-- 1 root root 283331868 Nov 21 10:49 jenkins_backup.tar.gz -rw-r--r-- 1 root root 190196115 Nov 21 10:41 jenkins_home.tar.gz -rw-r--r--. 1 root root 5627 Nov 8 13:39 jenkins.service [root@jenkins ~]# du -sh jenkins_backup.tar.gz 271M jenkins_backup.tar.gz [root@jenkins ~]# sz jenkins_backup.tar.gz rz zmodem trl+C ȡ 正在传输 jenkins_backup.tar.gz... 100% 276691 KB 17293 KB/ 00:00:16 0 还原 1、java 环境 [root@thinkpad-e490 ~]# yum install -y java-11-openjdk java-11-openjdk-devel [root@thinkpad-e490 ~]# java --version openjdk 11.0.17 2022-10-18 LTS OpenJDK Runtime Environment (Red_Hat-11.0.17.0.8-2.el7_9) (build 11.0.17+8-LTS) OpenJDK 64-Bit Server VM (Red_Hat-11.0.17.0.8-2.el7_9) (build 11.0.17+8-LTS, mixed mode, sharing) 2、还原 [root@thinkpad-e490 ~]# rz rz waiting to receive. zmodem trl+C ȡ 正在传输 jenkins_backup.tar.gz... 100% 276691 KB 39527 KB/ 00:00:07 0 [root@thinkpad-e490 ~]# tar xfz jenkins_backup.tar.gz [root@thinkpad-e490 ~]# ll total 553536 -rw-------. 1 root root 1542 Nov 16 17:47 anaconda-ks.cfg -rw------- 1 root root 4034 Nov 8 09:19 jenkins -rw-r--r-- 1 root root 93270402 Nov 2 07:55 jenkins-2.376-1.1.noarch.rpm -rw-r--r-- 1 root root 283331868 Nov 21 10:49 jenkins_backup.tar.gz -rw-r--r-- 1 root root 190196115 Nov 21 10:41 jenkins_home.tar.gz -rw-r--r-- 1 root root 5627 Nov 8 13:39 jenkins.service [root@thinkpad-e490 ~]# rpm -ivh jenkins-2.376-1.1.noarch.rpm warning: jenkins-2.376-1.1.noarch.rpm: Header V4 RSA/SHA512 Signature, key ID 45f2c3d5: NOKEY Preparing... ################################# [100%] Updating / installing... 1:jenkins-2.376-1.1 ################################# [100%] [root@thinkpad-e490 ~]# mv jenkins /etc/sysconfig/jenkins mv: overwrite ‘/etc/sysconfig/jenkins’? y [root@thinkpad-e490 ~]# mv jenkins.service /usr/lib/systemd/system/jenkins.service mv: overwrite ‘/usr/lib/systemd/system/jenkins.service’? y [root@thinkpad-e490 ~]# tar xfz jenkins_home.tar.gz -C /var/lib/ 3、启动 [root@thinkpad-e490 ~]# systemctl start jenkins [root@thinkpad-e490 ~]# systemctl status jenkins ● jenkins.service - Jenkins Continuous Integration Server Loaded: loaded (/usr/lib/systemd/system/jenkins.service; disabled; vendor preset: disabled) Active: active (running) since Mon 2022-11-21 10:57:43 CST; 1s ago Main PID: 1861 (java) CGroup: /system.slice/jenkins.service └─1861 /usr/bin/java -Djava.awt.headless=true -jar /usr/share/java/jenkins.war --webroot=%C/jenkins/war ... Nov 21 10:57:42 thinkpad-e490 jenkins[1861]: 2022-11-21 02:57:42.968+0000 [id=34] INFO hudson.sl...t sdk Nov 21 10:57:42 thinkpad-e490 jenkins[1861]: 2022-11-21 02:57:42.980+0000 [id=32] INFO jenkins.I...oaded Nov 21 10:57:42 thinkpad-e490 jenkins[1861]: 2022-11-21 02:57:42.982+0000 [id=32] INFO jenkins.I...apted Nov 21 10:57:43 thinkpad-e490 jenkins[1861]: 2022-11-21 02:57:43.019+0000 [id=33] INFO jenkins.I... jobs Nov 21 10:57:43 thinkpad-e490 jenkins[1861]: 2022-11-21 02:57:43.027+0000 [id=46] INFO jenkins.I...dated Nov 21 10:57:43 thinkpad-e490 jenkins[1861]: 2022-11-21 02:57:43.059+0000 [id=64] INFO hudson.ut...erver Nov 21 10:57:43 thinkpad-e490 jenkins[1861]: 2022-11-21 02:57:43.227+0000 [id=33] INFO o.j.main....46087 Nov 21 10:57:43 thinkpad-e490 jenkins[1861]: 2022-11-21 02:57:43.227+0000 [id=43] INFO jenkins.I...ation Nov 21 10:57:43 thinkpad-e490 jenkins[1861]: 2022-11-21 02:57:43.283+0000 [id=24] INFO hudson.li...nning Nov 21 10:57:43 thinkpad-e490 systemd[1]: Started Jenkins Continuous Integration Server. Hint: Some lines were ellipsized, use -l to show in full. [root@thinkpad-e490 ~]# ps -ef | grep jenkins root 1861 1 99 10:57 ? 00:00:44 /usr/bin/java -Djava.awt.headless=true -jar /usr/share/java/jenkins.war --webroot=%C/jenkins/war --httpPort=8080 root 2025 1539 0 10:57 pts/0 00:00:00 grep --color=auto jenkins [root@thinkpad-e490 ~]# free -h total used free shared buff/cache available Mem: 7.5G 896M 5.2G 9.4M 1.4G 6.4G Swap: 7.8G 0B 7.8G 4、访问
2022年11月21日
184 阅读
0 评论
0 点赞
2022-09-08
Typecho 1.2.0 部署
Typecho 1.2.0 部署 {bilibili bvid="BV15e411u7gH" page=""/} 环境 CentOS7.9 Nginx/1.20.1 PHP 7.2.34 mysql-5.7.37 初始化系统 curl -O file.youto.club/Script/init.sh sh init.sh blog [root@blog nginx]# cat /script/init.sh #!/usr/bin/bash echo "=-=-=- Action -=-=-=" hostnamectl set-hostname $1 echo "# ==> Hostname: " `hostname` systemctl stop firewalld && systemctl disable firewalld >/dev/null 2>&1 setenforce 0 >/dev/null 2>&1 sed -i "s/SELINUX=enforcing/SELINUX=disabled/g" /etc/selinux/config echo "# ==> Stop Firewalld && Selinux" mkdir /etc/yum.repos.d/bak -p mv /etc/yum.repos.d/*.repo /etc/yum.repos.d/bak curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo >/dev/null 2>&1 curl -o /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo >/dev/null 2>&1 yum repolist | grep repolist echo "# ==>repo" yum install -y lrzsz tree wget vim net-tools unzip bash-completion git >/dev/null 2>&1 sed -i "s/\#UseDNS no/UseDNS yes/g" /etc/ssh/sshd_config echo "# ==> SSH " echo "=-=-=- Done -=-=-=" 准备软件包 mysql-5.7.37-1.el7.x86_64.rpm.tar nginx-1.20.1.tar.gz typecho.zip mkdir /{repo,software,script} # MySQl wget http://file.youto.club/Repo/mysql-5.7.37-1.el7.x86_64.rpm.tar tar xf mysql-5.7.37-1.el7.x86_64.rpm.tar -c /repo ls /repo/mysql57_2009_repo/ vim /etc/yum.repos.d/mysql_local.repo yum repolist # PHP72 yum install -y http://rpms.remirepo.net/enterprise/remi-release-7.rpm yum install -y yum-utils yum-config-manager --enable remi-php72 # typecho wget https://github.com/typecho/typecho/releases/latest/download/typecho.zip mv typecho.zip /software/ [root@blog nginx]# cat /etc/yum.repos.d/mysql_local.repo [mysql57] name=mysql57 baseurl=file:///repo/mysql57_2009_repo/ gpgcheck=0 enabled=1 MySQL yum install -y mysql-server systemctl enable mysqld systemctl start mysqld grep pass /var/log/mysqld.log mysql -uroot -p [root@blog nginx]# mysql -uroot -p mysql> alter user user() identified by 'Admin@123'; Query OK, 0 rows affected (0.00 sec) mysql> create database typecho; Query OK, 1 row affected (0.00 sec) mysql> GRANT ALL ON typecho.* TO 'typecho'@'localhost' IDENTIFIED BY 'Abc@1234'; Query OK, 0 rows affected, 1 warning (0.00 sec) PHP yum install -y php72 php72 -v yum install -y php72-php-fpm php72-php-mbstring php72-php-mysqlnd systemctl enable php72-php-fpm.service systemctl start php72-php-fpm.service netstat -lntp rpm -ql php72-php-fpm vim /etc/opt/remi/php72/php-fpm.d/www.conf [root@blog nginx]# grep nginx /etc/opt/remi/php72/php-fpm.d/www.conf user = nginx group = nginx Nginx yum install -y nginx wget https://nginx.org/download/nginx-1.20.1.tar.gz mkdir /html unzip /software/typecho.zip cd /etc/nginx/ grep -Ev "#|^$" nginx.conf.default > nginx.conf vim nginx.conf mkdir -p /var/log/blog chown -R nginx.nginx /var/log/blog nginx -t chown -R nginx.nginx /html/ systemctl start nginx # cat /etc/nginx/nginx.conf worker_processes 1; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; server { listen 80; root /html; index index.html index.htm index.php; if (!-e $request_filename) { rewrite ^(.*)$ /index.php$1 last; } location ~ .*\.php(\/.*)*$ { include fastcgi.conf; fastcgi_pass 127.0.0.1:9000; } access_log /html/access.log combined; } } 访问
2022年09月08日
640 阅读
0 评论
0 点赞
2022-07-19
OpenStack-Pike 搭建之Cinder(七)
概述 OpenStack块存储服务(cinder)为虚拟机添加持久的存储,块存储提供一个基础设施为了管理卷,以及和OpenStack计算服务交互,为实例提供卷。此服务也会激活管理卷的快照和卷类型的功能。 块存储服务通常包含下列组件: cinder-api 接受API请求,并将其路由到cinder-volume执行。 cinder-volume 与块存储服务和例如cinder-scheduler的进程进行直接交互。它也可以与这些进程通过一个消息队列进行交互。cinder-volume服务响应送到块存储服务的读写请求来维持状态。它也可以和多种存储提供者在驱动架构下进行交互。 cinder-scheduler守护进程 选择最优存储提供节点来创建卷。其与nova-scheduler组件类似。 cinder-backup daemon cinder-backup服务提供任何种类备份卷到一个备份存储提供者。就像cinder-volume服务,它与多种存储提供者在驱动架构下进行交互。 消息队列 在块存储的进程之间路由信息。 安装并配置控制节点 先决条件 1、创建数据库 root 用户连接到数据库服务器 mysql -u root -p000000 创建 cinder 数据库 CREATE DATABASE cinder; 允许 cinder 数据库的cinder用户访问权限: GRANT ALL PRIVILEGES ON cinder.* TO 'cinder'@'localhost' IDENTIFIED BY '000000'; GRANT ALL PRIVILEGES ON cinder.* TO 'cinder'@'%' IDENTIFIED BY '000000'; 2、获取 admin 凭证 . admin-openrc 3、创建服务证书 创建一个 cinder 用户 openstack user create --domain default --password 000000 cinder 添加 admin 角色到 cinder 用户上 openstack role add --project service --user cinder admin 创建服务实体 openstack service create --name cinderv2 --description "OpenStack Block Storage" volumev2 openstack service create --name cinderv3 --description "OpenStack Block Storage" volumev3 创建服务API openstack endpoint create --region RegionOne \ volumev2 public http://controller:8776/v2/%\(project_id\)s openstack endpoint create --region RegionOne \ volumev2 internal http://controller:8776/v2/%\(project_id\)s openstack endpoint create --region RegionOne \ volumev2 admin http://controller:8776/v2/%\(project_id\)s openstack endpoint create --region RegionOne \ volumev3 public http://controller:8776/v3/%\(project_id\)s openstack endpoint create --region RegionOne \ volumev3 internal http://controller:8776/v3/%\(project_id\)s openstack endpoint create --region RegionOne \ volumev3 admin http://controller:8776/v3/%\(project_id\)s {collapse} {collapse-item label="CMD"} [root@openstack ~]# mysql -u root -p000000 Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 379 Server version: 10.1.20-MariaDB MariaDB Server Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]> CREATE DATABASE cinder; Query OK, 1 row affected (0.00 sec) MariaDB [(none)]> GRANT ALL PRIVILEGES ON cinder.* TO 'cinder'@'localhost' \ -> IDENTIFIED BY '000000'; Query OK, 0 rows affected (0.00 sec) MariaDB [(none)]> GRANT ALL PRIVILEGES ON cinder.* TO 'cinder'@'%' \ -> IDENTIFIED BY '000000'; Query OK, 0 rows affected (0.00 sec) MariaDB [(none)]> exit Bye [root@openstack ~]# . admin-openrc [root@openstack ~]# openstack user create --domain default --password 000000 cinder +---------------------+----------------------------------+ | Field | Value | +---------------------+----------------------------------+ | domain_id | default | | enabled | True | | id | 15c1c62c21f543d984563abe5c063726 | | name | cinder | | options | {} | | password_expires_at | None | +---------------------+----------------------------------+ [root@openstack ~]# openstack role add --project service --user cinder admin [root@openstack ~]# openstack service create --name cinderv2 \ > --description "OpenStack Block Storage" volumev2 +-------------+----------------------------------+ | Field | Value | +-------------+----------------------------------+ | description | OpenStack Block Storage | | enabled | True | | id | 052ab471e8ed4e5ca687bd73537935b5 | | name | cinderv2 | | type | volumev2 | +-------------+----------------------------------+ [root@openstack ~]# openstack service create --name cinderv3 \ > --description "OpenStack Block Storage" volumev3 +-------------+----------------------------------+ | Field | Value | +-------------+----------------------------------+ | description | OpenStack Block Storage | | enabled | True | | id | af52c95327614d1e9fb70286fcb552ea | | name | cinderv3 | | type | volumev3 | +-------------+----------------------------------+ [root@openstack ~]# openstack endpoint create --region RegionOne \ > volumev2 public http://controller:8776/v2/%\(project_id\)s +--------------+------------------------------------------+ | Field | Value | +--------------+------------------------------------------+ | enabled | True | | id | 2c3e428aa796442696e7f5919175c1e2 | | interface | public | | region | RegionOne | | region_id | RegionOne | | service_id | 052ab471e8ed4e5ca687bd73537935b5 | | service_name | cinderv2 | | service_type | volumev2 | | url | http://controller:8776/v2/%(project_id)s | +--------------+------------------------------------------+ [root@openstack ~]# openstack endpoint create --region RegionOne \ > volumev2 internal http://controller:8776/v2/%\(project_id\)s +--------------+------------------------------------------+ | Field | Value | +--------------+------------------------------------------+ | enabled | True | | id | c25695b19d1b4e33a9ea2d4c023b8732 | | interface | internal | | region | RegionOne | | region_id | RegionOne | | service_id | 052ab471e8ed4e5ca687bd73537935b5 | | service_name | cinderv2 | | service_type | volumev2 | | url | http://controller:8776/v2/%(project_id)s | +--------------+------------------------------------------+ [root@openstack ~]# openstack endpoint create --region RegionOne \ > volumev2 admin http://controller:8776/v2/%\(project_id\)s +--------------+------------------------------------------+ | Field | Value | +--------------+------------------------------------------+ | enabled | True | | id | 2928643fb2ac4bd99aa8cc795b55f7e1 | | interface | admin | | region | RegionOne | | region_id | RegionOne | | service_id | 052ab471e8ed4e5ca687bd73537935b5 | | service_name | cinderv2 | | service_type | volumev2 | | url | http://controller:8776/v2/%(project_id)s | +--------------+------------------------------------------+ [root@openstack ~]# openstack endpoint create --region RegionOne \ > volumev3 public http://controller:8776/v3/%\(project_id\)s +--------------+------------------------------------------+ | Field | Value | +--------------+------------------------------------------+ | enabled | True | | id | a63b291e2ed4450e91ee574e4f9b4a7a | | interface | public | | region | RegionOne | | region_id | RegionOne | | service_id | af52c95327614d1e9fb70286fcb552ea | | service_name | cinderv3 | | service_type | volumev3 | | url | http://controller:8776/v3/%(project_id)s | +--------------+------------------------------------------+ [root@openstack ~]# openstack endpoint create --region RegionOne \ > volumev3 internal http://controller:8776/v3/%\(project_id\)s +--------------+------------------------------------------+ | Field | Value | +--------------+------------------------------------------+ | enabled | True | | id | f47bd12c58af41298cdc7c5fe76cb8d4 | | interface | internal | | region | RegionOne | | region_id | RegionOne | | service_id | af52c95327614d1e9fb70286fcb552ea | | service_name | cinderv3 | | service_type | volumev3 | | url | http://controller:8776/v3/%(project_id)s | +--------------+------------------------------------------+ [root@openstack ~]# openstack endpoint create --region RegionOne \ > volumev3 admin http://controller:8776/v3/%\(project_id\)s +--------------+------------------------------------------+ | Field | Value | +--------------+------------------------------------------+ | enabled | True | | id | 6dd9f8c300754f32abecf2b77e241d5d | | interface | admin | | region | RegionOne | | region_id | RegionOne | | service_id | af52c95327614d1e9fb70286fcb552ea | | service_name | cinderv3 | | service_type | volumev3 | | url | http://controller:8776/v3/%(project_id)s | +--------------+------------------------------------------+ {/collapse-item} {/collapse} 安装并配置组件 1、安装软件包 yum install -y openstack-cinder 2、配置 cinder.conf # sed -i.bak '/^#/d;/^$/d' /etc/cinder/cinder.conf # vim /etc/cinder/cinder.conf [database] # 配置数据库访问 connection = mysql+pymysql://cinder:000000@controller/cinder [DEFAULT] # 配置RabbitMQ 消息队列访问 transport_url = rabbit://openstack:000000@controller # 配置身份服务访问 auth_strategy = keystone # 控制器节点的管理接口 IP 地址 my_ip = 178.120.2.100 [keystone_authtoken] # 配置身份服务访问 auth_uri = http://controller:5000 auth_url = http://controller:35357 memcached_servers = controller:11211 auth_type = password project_domain_name = default user_domain_name = default project_name = service username = cinder password = 000000 [oslo_concurrency] # 配置锁定路径 lock_path = /var/lib/cinder/tmp 3、同步数据库 # su -s /bin/sh -c "cinder-manage db sync" cinder 配置计算节点使用块设备存储 配置 nova.conf # vim /etc/nova/nova.conf [cinder] os_region_name = RegionOne 完成安装 1、重启计算API服务 systemctl restart openstack-nova-api.service 2、启动设备块存储服务并设置开机自启 systemctl enable openstack-cinder-api.service openstack-cinder-scheduler.service systemctl start openstack-cinder-api.service openstack-cinder-scheduler.service 安装并配置存储节点 先决条件 1、安装支持工具包 yum install -y lvm2 device-mapper-persistent-data systemctl enable lvm2-lvmetad.service && systemctl start lvm2-lvmetad.service 2、创建LVM物理卷 pvcreate /dev/sdb 3、创建LVM卷组 vgcreate cinder-volumes /dev/sdb 4、添加过滤器 # vim /etc/lvm/lvm.conf filter = [ "a/vdb/", "r/.*/"] {collapse} {collapse-item label="CMD"} [root@storage_node ~]# lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sr0 11:0 1 1024M 0 rom vda 252:0 0 30G 0 disk ├─vda1 252:1 0 1G 0 part /boot └─vda2 252:2 0 29G 0 part └─centos-root 253:0 0 29G 0 lvm / vdb 252:16 0 100G 0 disk vdc 252:32 0 100G 0 disk [root@storage_node ~]# pvcreate /dev/vdb Physical volume "/dev/vdb" successfully created. [root@storage_node ~]# vgcreate cinder-volumes /dev/vdb Volume group "cinder-volumes" successfully create {/collapse-item} {/collapse} 安装并配置组件 1、安装软件包 yum install -y openstack-cinder targetcli python-keystone 2、配置 cinder.conf # sed -i.bak '/^#/d;/^$/d' /etc/cinder/cinder.conf # vim /etc/cinder/cinder.conf [database] # 配置数据库访问 connection = mysql+pymysql://cinder:000000@controller/cinder [DEFAULT] # RabbitMQ 消息队列访问 transport_url = rabbit://openstack:000000@controller # 配置身份服务访问 auth_strategy = keystone # 存储节点上管理网络接口的 IP 地址 my_ip = 178.120.2.192 # 启用 LVM 后端 enabled_backends = lvm # 配置镜像服务 API 的位置 glance_api_servers = http://controller:9292 [keystone_authtoken] # 配置身份服务访问 auth_uri = http://controller:5000 auth_url = http://controller:35357 memcached_servers = controller:11211 auth_type = password project_domain_name = default user_domain_name = default project_name = service username = cinder password = 000000 [lvm] volume_driver = cinder.volume.drivers.lvm.LVMVolumeDriver volume_group = cinder-volumes iscsi_protocol = iscsi iscsi_helper = lioadm [oslo_concurrency] # 配置锁定路径 lock_path = /var/lib/cinder/tmp 完成安装 启动存储卷服务,设置开机自启 systemctl enable openstack-cinder-volume.service target.service systemctl start openstack-cinder-volume.service target.service
2022年07月19日
203 阅读
0 评论
0 点赞
1
2
3
4
...
16