首页
归档
时光轴
推荐
Cloud
图床
导航
Search
1
Deploy OpenStack offline based on Kolla
1,056 阅读
2
openstact 基础环境安装 (手动版)
853 阅读
3
Typecho 1.2.0 部署
821 阅读
4
Mariadb 主从复制&读写分离
794 阅读
5
FusionCompute8.0 体验
762 阅读
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
篇与
的结果
2021-07-16
Mariadb Galera Cluster
Mariadb Galera Cluster 环境准备 修改主机名 配置主机名解析 关闭防火墙 & selinux 配置 yum 源 hostnamectl set-hostname node1 echo "10.35.172.77 node1 10.35.172.78 node2 10.35.172.79 node3" >> /etc/hosts systemctl stop firewalld && setenforce 0 echo "[mariadb] name=mariadb baseurl=ftp://10.35.172.81/gpmall-repo gpgcheck=0 enabled=1 [centos] name=centos baseurl=ftp://10.35.172.81/centos gpgcheck=0 enabled=1" > /etc/yum.repos.d/ftp.repo 安装Mariadb Galera Cluster # 安装 mariadb yum install mariadb-server -y # 初始化数据库 systemctl start mariadb mysql_secure_installation u # 配置数据库文件 /etc/my.cnf.d/server.cnf # 修改数据库密码 grant all privileges on *.* to root@'%' identified by '123456'; # 停止数据库 systemctl stop mariadb # 启动数据库集群 node1 galera_new_cluster node2 & node3 systemctl start mariadb # 验证 node1 MariaDB [(none)]> show status like "wsrep_ready"; MariaDB [(none)]> show status like "wsrep_cluster_size"; MariaDB [(none)]> show status like "wsrep%"; MariaDB [(none)]> create database abc; MariaDB [(none)]> show databases; node2 MariaDB [(none)]> show databases; node3 MariaDB [(none)]> show databases; wsrep_on=ON wsrep_provider=/usr/lib64/galera/libgalera_smm.so # 集群的主机IP wsrep_cluster_address="gcomm://10.35.172.77,10.35.172.78,10.35.172.79" # 主机名 wsrep_node_name=node1 # 主机IP wsrep_node_address=10.35.172.77 binlog_format=row default_storage_engine=InnoDB innodb_autoinc_lock_mode=2 wsrep_slave_threads=1 innodb_flush_log_at_trx_commit=0 innodb_buffer_pool_size=120M wsrep_sst_method=rsync wsrep_causal_reads=ON # 主机IP bind-address=10.35.172.77 安装 HAProxy ## node1 # 安装 HAProxy yum install haproxy -y # HAProxy服务配置 vi /etc/haproxy/haproxy.cfg global log 127.0.0.1 local2 chroot /var/lib/haproxy maxconn 4000 user haproxy group haproxy daemon stats socket /var/lib/haproxy/stats defaults log global maxconn 4000 option redispatch retries 3 timeout http-request 10s timeout queue 1m timeout connect 10s timeout client 1m timeout server 1m timeout check 10s listen stats bind 10.35.172.77:9000 # (改) mode http stats enable stats uri /stats stats auth admin:admin stats admin if TRUE listen mariadb balance roundrobin mode tcp option tcplog option tcpka bind 10.35.172.77:3307 # (改) server node1 10.35.172.77:3306 check weight 1 server node2 10.35.172.78:3306 check weight 1 server node3 10.35.172.79:3306 check weight 1 # 启动 HAProxy systemctl start haproxy netstat -ntpl # HAProxy服务验证 网页访问 10.35.172.77:9000/stats (admin/admin) mysql -h 10.35.172.77 -P 3307 -uroot -p000000 # 数据库设置 服务ID mysql -h 10.35.172.77 -uroot -p123456 -e "SET GLOBAL server_id=77;" mysql -h 10.35.172.78 -uroot -p000000 -e "SET GLOBAL server_id=78;" mysql -h 10.35.172.79 -uroot -p000000 -e "SET GLOBAL server_id=79;" # 检查 HAProxy服务 正常运行 mysql -h 10.35.172.77 -P 3307 -uroot -p000000 -e "show variables like 'server_id'" # 多次执行查看server_id
2021年07月16日
306 阅读
0 评论
0 点赞
2021-07-06
这个暑假,从明天开始
{lamp/} {music id="1837559625" color="#9ab5d0"/} 20岁的人了,暑假再也不能躺在家那么久了。也该有些事做做,想想。高中结束,玩了一月,考驾照两月,菜鸟搬砖两月。五个月做了三件事(玩,学,工),有着不同状态。大一结束,不想去搬砖想学点东西。在家看看视频,学点技能。大二结束,对学的东西有了点了解,深知不足,留校闭关两月。 简单谈谈我的大学两年,大一和所有同龄人一样懵懵懂懂不住所措。下课就回宿舍,吹吹空调,刷刷抖音看看剧。晚上熬夜,白天上课打盹。数学不听,外语不学。晚自习,睡觉看小说或者参加部门社团活动。大一加了,学习部和辩论社。参加学习部不是因为去学习,是宣传单上写的啥锻炼口才,成长学习之类的。辩论社是之前学校没有这种社团活动,又恰巧对它感兴趣。后来学院的辩论赛,还为班级出过力,最后好像是个亚军。后面又不太喜欢辩论,觉得能力足,也不想在上花太多时间。在社团留个会计的闲职和辩论留着最后一丝关系。可也没花精力在社团,也很惭愧。大二的时候就好了很多,更多的原因是之前走到单招。也许这也是上学的最后一站,所以知道自己缺的是什么,应该花一些精力去学专业技能。国庆后,老师联系去云计算工作室学习。开始了,比较稳定学习环境和时间。每天下午没课都在那,可还是坐不住,吃完晚饭就回宿舍。大二下学期,学了点东西。做了这个博客,开始写文档,留些记录。 看看时间 7月6号。已经开始陆陆续续放假,食堂的窗口也越来越少。这个暑假,从明天开始,你准备好了吗??
2021年07月06日
274 阅读
0 评论
3 点赞
2021-07-04
1+X 初级实验
私有云实训 一、本地 YUM 源管理 使用 VMWare 软件启动提供的 xserver1 虚拟机(配置虚拟机 xserver1 的 IP 为 `192.168.100.11`,主机名为 xserver1) 在虚拟机的/root 目录下,存在一个`CentOS-7-x86_64-DVD-1511.iso` 的镜像文件,使用这个镜像文件配置本地 yum 源, 要求将这个镜像文件挂载在`/opt/centos` 目录,请问如何配置自己的 local.repo 文件,使得可以使用该镜像中的软件包,安装软件。 请将 local.repo 文件的内容和执行 yum repolist 的返回结果(简要)写到下方。 echo "TYPE=Ethernet BOOTPROTO=static DEVICE=eno16777736 ONBOOT=yes IPADDR=192.168.100.11 GATEWAY=192.168.100.1 PREFIX=24" > /etc/sysconfig/network-scripts/ifcfg-eno16777736 [root@xserver1 ~]# hostnamectl set-hostname xserver1 [root@xserver1 ~]# bash [root@xserver1 ~]#cd [root@xserver1 ~]# mkdir /opt/centos [root@xserver1 ~]# mount -o loop CentOS-7-x86_64-DVD-1511.iso /opt/centos/ [root@xserver1 ~]# mkdir /etc/yum.repos.d/bak [root@xserver1 ~]# mv /etc/yum.repos.d/*.repo /etc/yum.repos.d/bak/ echo "[centos] name=centos baseurl=file:///opt/centos gpgcheck=0 enabled=1" > /etc/yum.repos.d/local.repo [root@xserver1 ~]# yum clean all [root@xserver1 ~]# yum repolist Loaded plugins: fastestmirror centos | 3.6 kB 00:00:00 (1/2): centos/group_gz | 155 kB 00:00:00 (2/2): centos/primary_db | 2.8 MB 00:00:00 Determining fastest mirrors repo id repo name status centos centos 3,723 repolist: 3,723 二、FTP 安装使用 使用 xserver1 虚拟机,安装 `ftp 服务`,并配置 ftp 的共享目录为/opt。 使用VMWare 软件继续启动提供的 xserver2 虚拟机(配置虚拟机 xserver2 的 IP 为`192.168.100.12`,主机名为xserver2), 并创建该虚拟机的 yum 源文件 `ftp.repo` 使用xserver1 的ftp 源(配置文件中的FTP 地址使用主机名)。 配置完成后,将xserver1节点执行 netstat -ntpl 命令(netstat 命令若不能用,则自行安装 net-tools 工具)的返回结果(简要)和将 xserver2 节点的 ftp.repo 文件内容写到下方。 [root@xserver1 ~]# yum instal vsftpd -y [root@xserver1 ~]# echo anon_root=/opt/ >> /etc/vsftpd/vsftpd.conf [root@xserver1 ~]# systemctl start vsftpd && systemctl enable vsftpd echo "TYPE=Ethernet BOOTPROTO=static DEVICE=eno16777736 ONBOOT=yes IPADDR=192.168.100.12 GATEWAY=192.168.100.1 PREFIX=24" > /etc/sysconfig/network-scripts/ifcfg-eno16777736 [root@localhost ~]# hostnamectl set-hostname xserver2 [root@localhost ~]# bash echo "[centos] name=centos baseurl=ftp://192.168.100.11/centos gpgcheck=0 enabled=1" > /etc/yum.repos.d/ftp.repo [root@xserver2 ~]# setenforce 0 [root@xserver2 ~]# systemctl stop firewalld && systemctl disable firewalld [root@xserver1 ~]# setenforce 0 [root@xserver1 ~]# systemctl stop firewalld && systemctl disable firewalld [root@xserver2 ~]# yum clean all [root@xserver2 ~]# yum repolist Loaded plugins: fastestmirror centos | 3.6 kB 00:00:00 (1/2): centos/group_gz | 155 kB 00:00:00 (2/2): centos/primary_db | 2.8 MB 00:00:00 Determining fastest mirrors repo id repo name status centos centos 3,723 repolist: 3,723 [root@xserver1 ~]# yum install -y net-tools [root@xserver1 ~]# netstat -ntpl tcp6 0 0 :::21 :::* LISTEN 3280/vsftpd 三、NFS 服务管理 使用 xserver1、xserver2 虚拟机,安装 NFS 服务所需要的软件包,将 xserver1 节点中的/mnt/share 目录使用 NFS 服务共享出来(目录不存在请自行创建,要求可访问共享目录的网段为 192.168.100.0/24), 接着在 xserver2 节点上,将 xserver1中共享的文件挂载到/mnt 目录下。 操作完毕后,依次将 xserver1 节点上执行showmount -e ip 命令和 xserver2 节点上执行 df -h 命令的返回结果(简要)写到下方 [root@xserver1 ~]# yum -y install nfs-utils rpcbind [root@xserver2 ~]# yum -y install nfs-utils rpcbind echo "/mnt/share 192.168.100.0/24(rw,no_root_squash,no_all_squash,sync,anonuid=501,anongid=501)" > /etc/exports [root@xserver1 ~]# exportfs -r [root@xserver1 ~]# systemctl start rpcbind && systemctl enable rpcbind [root@xserver1 ~]# systemctl start nfs-server && systemctl enable nfs-server [root@xserver1 ~]# showmount -e 192.168.100.11 Export list for 192.168.100.11: /mnt/share 192.168.100.0/24 [root@xserver2 ~]# setenforce 0 [root@xserver2 ~]# systemctl stop firewalld && systemctl disable firewalld [root@xserver1 ~]# setenforce 0 [root@xserver1 ~]# systemctl stop firewalld && systemctl disable firewalld [root@xserver2 ~]# mount -t nfs 192.168.100.11:/mnt/share /mnt [root@xserver2 ~]# df -h 192.168.100.11:/mnt/share 36G 7.6G 29G 22% /mnt 四、主从数据库管理 在 xserver1、xserver2 上安装 mariadb 数据库, 并配置为主从数据库(xserver1 为主节点、xserver2 为从节点),实现两个数据库的主从同步。 配置完毕后,请在 xserver2 上的数据库中执行“show slave status \G”命令查询从节点复制状态,将查询到的结果(简要)写到下方。 # xserver1 & xserver2 都执行 echo "192.168.100.11 mysql1 192.168.100.12 mysql2" >> /etc/hosts [root@xserver1 ~]# yum install -y mariadb mariadb-server [root@xserver1 ~]# systemctl start mariadb && systemctl enable mariadb [root@xserver2 ~]# yum install -y mariadb mariadb-server [root@xserver2 ~]# systemctl start mariadb && systemctl enable mariadb # xserver1 & xserver2 都执行 [root@xserver1 ~]# mysql_secure_installation Disallow root login remotely? [Y/n] n 其他为 yes ;密码设置为 000000 # 为 xserver1/etc/my.cnf 中的[mysqld]增添如下内容 log_bin=mysql-bin binlog_ignore_db=mysql server_id=11 # xserver1 MariaDB [(none)]> grant all privileges on *.* to root@'%' identified by "000000"; MariaDB [(none)]> grant replication slave on *.* to 'user'@'mysql2' identified by '000000'; # 为 xserver2 /etc/my.cnf 中的[mysqld]增添如下内容 log_bin=mysql-bin binlog_ignore_db=mysql server_id=12 # xserver2 MariaDB [(none)]> change master to master_host='mysql1',master_user='user',master_password='000000'; MariaDB [(none)]> start slave; MariaDB [(none)]> show slave status\G `Slave_IO_Running: Yes` `Slave_SQL_Running: Yes` ## 验证数据同步 # xserver1 MariaDB [(none)]> create database test; MariaDB [(none)]> use test; MariaDB [test]> create table company(id int not null primary key,name varchar(50),addr varchar(255)); MariaDB [test]> insert into company values(1,"alibaba","china"); MariaDB [test]> select * from company; # xserver2 MariaDB [(none)]> show databases; MariaDB [(none)]> use test; MariaDB [test]> show tables; MariaDB [test]> select * from company; +----+---------+-------+ | id | name | addr | +----+---------+-------+ | 1 | alibaba | china | +----+---------+-------+ 1 row in set (0.01 sec) 五、LNMP 环境部署 使用 xserver1 节点,安装单节点 lnmp 环境。 安装 lnmp 环境需要用到的 YUM 源为 CentOS-7-x86_64-DVD-1511.iso 和 lnmp 目录(均在/root 目录下)。 安装并配置完 lnmp 环境后。依次查询数据库、nginx、php 服务的状态,并使用 netstat -ntpl 命令查看端口开放情况。 最后依次将查询服务状态的返回结果(简要),和查看端口开放情况的返回结果(简要)写到下方。 echo "[lnmp] name=centos baseurl=file:///root/lnmp gpgcheck=0 enabled=1" >> /etc/yum.repos.d/local.repo [root@xserver1 ~]# yum clean all [root@xserver1 ~]# yum repolist [root@xserver1 ~]# yum install -y nginx echo "server { listen 80; server_name localhost; location / { root /usr/share/nginx/html; index index.php index.html index.htm; } error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/html; } location ~ \.php$ { root /usr/share/nginx/html; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } }" > /etc/nginx/conf.d/default.conf [root@xserver1 ~]# mysql -uroot -p000000 MariaDB [(none)]> grant all privileges on *.* to root@localhost identified by '000000' with grant option; MariaDB [(none)]> grant all privileges on *.* to root@'%' identified by '000000' with grant option; MariaDB [(none)]> create database wordpress; [root@xserver1 ~]# yum install -y php-fpm php-mysql [root@xserver1 ~]# vi /etc/php-fpm.d/www.conf #修改下两行 user = nginx group = nginx [root@xserver1 ~]# systemctl restart nginx php-fpm [root@xserver1 ~]# yum install net-tools [root@xserver1 ~]# netstat -ntpl 六、部署 WordPress 应用 使用 xserver1 节点,基于 lnmp 环境,部署 WordPress 应用(WordPress 源码包在/root 目录下)。 应用部署完毕后,设置 WordPress 的站点标题为自己的姓名( 例: 名字叫张三, 则设置站点标题为张三的 BLOG), 设置完毕后登录WordPresss 首页。最后将命令 curl ip(ip 为 wordpress 的首页 ip)的返回结果(简要)写到下方。 [root@xserver1 ~]# yum install -y unzip [root@xserver1 ~]# unzip wordpress-4.7.3-zh_CN.zip [root@xserver1 ~]# cp -rfv wordpress/* /usr/share/nginx/html/ echo "<?php define('DB_NAME', 'wordpress'); define('DB_USER', 'root'); define('DB_PASSWORD', '000000'); define('DB_HOST', 'localhost'); define('DB_CHARSET', 'utf8mb4'); define('DB_COLLATE', ''); define('AUTH_KEY', '<*sWiXc.1x HhNW`r>o?o7b,l`PoiY`_Ji/YD>o4Cc}460|Bew2-Ba)X/LZmsbvS'); define('SECURE_AUTH_KEY', '`v$-3/Gk`/&yRoSBoVrc+%*=WGmQc;R0!KxY}HM61V9Pcyz&= Xw986qi4/,W*4j'); define('LOGGED_IN_KEY', '/%Iuho!m&L#d1J=S:*6C~4>7@72$ZcGJcE=bW)jM0wl^|ZO2YIX5OllUMG*Wr1?W'); define('NONCE_KEY', 'K!KOU7%&2K=x^o7p7VG>/ast51N>ry_Rcl^)c}WOong&~cuh>p 8twe{B]Z[7Q)]'); define('AUTH_SALT', '#ho(+-ICZ>@fy>^;U],e!9Y<sbGV$|LLo)F[Lkveh]~s|Q9KQ)g#cCrgw2fGviP,'); define('SECURE_AUTH_SALT', 'l~@~( d2k-Gh?VczpK(_4}8#;BEX0RFncorH#qf1{r<-1$DpM#@bcBKjv)R4Q}_9'); define('LOGGED_IN_SALT', '1q.8W-yy)tNt^$+pSScX>o*UDX!T?>I%{_RP~<*heM|A6j[6OfL4]w 2:SI)cuud'); define('NONCE_SALT', '6kt&5<?n%]:z4[%i6,jL-l@i#!$v8x-[JXERj+*dja{]))<e`aE!qwzy>?kw$IKI'); $table_prefix = 'wp_'; define('WP_DEBUG', false); define('WP_ZH_CN_ICP_NUM', true); if ( !defined('ABSPATH') ) define('ABSPATH', dirname(__FILE__) . '/'); require_once(ABSPATH . 'wp-settings.php'); " > /usr/share/nginx/html/wp-config.php [root@xserver1 ~]# systemctl restart mariadb nginx php-fpm [root@xserver1 ~]# netstat -lntp [root@xserver1 ~]# curl 192.168.100.11 七、Linux 存储 LVM 管理 使用 xserver1 虚拟机,使用 VMWare 软件自行添加一块大小为 20G 的硬盘, 使用 fdisk 命令对该硬盘进形分区, 要求分出两个大小为 5G 的分区。使用两个分区,创建名 xcloudvg 的卷组, 然后再创建一个 5G 的分区,将 xcloudvg 扩容至 15G,最后执行 vgdisplay 命令查看卷组信息。 将上述所有操作命令和返回结果(简要)写到下方。 [root@controller ~]# lsblk [root@controller ~]# fdisk /dev/sdb # 创建分区 3个分区 [root@controller ~]# lsblk [root@localhost ~]# pvcreate /dev/sdb1 /dev/sdb2 [root@localhost ~]# vgcreate xcloudvg /dev/sdb[1-2] [root@localhost ~]# vgextend xcloudvg /dev/sdb3 八、OpenStack Keystone 管理 使用 VMWare 软件启动提供的 opensatckallinone 镜像,自行检查 openstack 中各服务的状态,若有问题自行排查。 在 keystone 中创建用户 testuser,密码为123456,创建好之后,查看 testuser 的详细信息。 将上述所有操作命令及返回结果(简要)写到下方。 [root@controller ~]# source /etc/keystone/admin-openrc.sh [root@controller ~]# openstack user create --password 123456 --domain xiandian usertest [root@controller ~]# openstack user show usertest +-----------+----------------------------------+ | Field | Value | +-----------+----------------------------------+ | domain_id | 9321f21a94ef4f85993e92a228892418 | | enabled | True | | id | b9b24fd835344500837cb2cbfb79d90d | | name | usertest | +-----------+----------------------------------+ 九、OpenStack Glance 管理 使用 VMWare 软件启动提供的 opensatckallinone 镜像,自行检查 openstack 中各服务的状态,若有问题自行排查。 在 xserver1 节点的/root 目录下存在一个cirros-0.3.4-x86_64-disk.img 镜像; 使用 glance 命令将镜像上传, 并命名为mycirros, 最后将glance image-show id 命令的返回结果(简要)写到下方。 [root@controller ~]# source /etc/keystone/admin-openrc.sh [root@controller ~]# glance image-create --name "mycirros" --disk-format qcow2 --container-format bare --progress < cirros-0.3.2-x86_64-disk.img [=============================>] 100% +------------------+--------------------------------------+ | Property | Value | +------------------+--------------------------------------+ | checksum | 64d7c1cd2b6f60c92c14662941cb7913 | | container_format | bare | | created_at | 2021-06-30T19:45:27Z | | disk_format | qcow2 | | id | ae634816-62f7-4bcb-8b89-04166478d834 | | min_disk | 0 | | min_ram | 0 | | name | mycirros | | owner | f9ff39ba9daa4e5a8fee1fc50e2d2b34 | | protected | False | | size | 13167616 | | status | active | | tags | [] | | updated_at | 2021-06-30T19:45:27Z | | virtual_size | None | | visibility | private | +------------------+--------------------------------------+ [root@controller ~]# glance image-show mycirros +------------------+--------------------------------------+ | Property | Value | +------------------+--------------------------------------+ | checksum | 64d7c1cd2b6f60c92c14662941cb7913 | | container_format | bare | | created_at | 2021-06-30T19:45:27Z | | disk_format | qcow2 | | id | ae634816-62f7-4bcb-8b89-04166478d834 | | min_disk | 0 | | min_ram | 0 | | name | mycirros | | owner | f9ff39ba9daa4e5a8fee1fc50e2d2b34 | | protected | False | | size | 13167616 | | status | active | | tags | [] | | updated_at | 2021-06-30T19:45:27Z | | virtual_size | None | | visibility | private | +------------------+--------------------------------------+ 十、Docker 安装 使用 xserver1 节点,自行配置 YUM 源,安装 docker 服务(需要用到的包为xserver1 节点/root 目录下的 Docker.tar.gz)。 安装完服务后,将 registry_latest.tar 上传到 xserver1 节点中并配置为私有仓库。 要求启动 registry 容器时,将内部保存文件的目录映射到外部的/opt/registry 目录,将内部的 5000 端口映射到外部5000 端口。 依次将启动 registry 容器的命令及返回结果、执行 docker info 命令的返回结果(简要)写到下方。 mkdir /opt/docker mv Docker.tar.gz /opt/docker tar -zxvf /opt/docker/Docker.tar.gz echo "[kubernetes] name=kubernetes baseurl=file:///opt/docker/Docker gpgcheck=0 enabled=1 " >> /etc/yum.repos.d/local.repo [root@xserver1 ~]# yum clean all [root@xserver1 ~]# yum repolist [root@xserver1 ~]# yum upgrade -y [root@xserver1 ~]# uname -r [root@xserver1 ~]# iptables -t filter -F [root@xserver1 ~]# iptables -t filter -X [root@xserver1 ~]# iptables -t filter -Z [root@xserver1 ~]# /usr/sbin/iptables-save [root@xserver1 ~]# reboot [root@xserver1 ~]# rm -rf /etc/yum.repos.d/C* [root@xserver1 ~]# yum clean all [root@xserver1 ~]# yum repolist cat >> /etc/sysctl.conf << EOF net.ipv4.ip_forward=1 net.bridge.bridge-nf-call-ip6tables = 1 net.bridge.bridge-nf-call-iptables = 1 EOF [root@xserver1 ~]# sysctl -p [root@xserver1 ~]# modprobe br_netfilter [root@xserver1 ~]# yum install -y yum-utils device-mapper-persistent-data [root@xserver1 ~]# yum install docker-ce -y [root@xserver1 ~]# systemctl daemon-reload [root@xserver1 ~]# systemctl restart docker [root@xserver1 ~]# systemctl enable docker [root@xserver1 ~]# docker info [root@xserver1 ~]# docker load -i /opt/docker/images/registry_latest.tar [root@xserver1 opt]# docker run -d -p 5000:5000 -v /opt/registry:/var/lib/registry f32a97de94e1 十一、Dockerfile 编写 使用 xserver1 节点,新建目录 centos-jdk,将提供的 jdk-8u141-linux-x64.tar.gz 复制新建的目录,然后编辑 Dockerfile 文件,文件要求如下: 1.使用 centos:latest 基础镜像; 2.指定作为为 xiandian; 3.新建文件夹/usr/local/java 用于存放 jdk 文件; 4.将 JDK 文件复制到镜像内创建的目录并自动解压; 5.创建软连接:ln -s /usr/local/java/jdk1.8.0_141 /usr/local/java/jdk; 6.设置环境变量如下 ENV JAVA_HOME /usr/local/java/jdk ENV JRE_HOME ${JAVA_HOME}/jre ENV CLASSPATH .:${JAVA_HOME}/lib:${JRE_HOME}/lib ENV PATH ${JAVA_HOME}/bin:$PATH 编写完毕后,构建名为 centos-jdk 的镜像,构建成功后,查看镜像列表。 最后将 Dockerfile 的内容、构建镜像的操作命令、查看镜像列表的命令和返回的(简要)写到下方。 [root@xserver1 ~]# mkdir /home/centos-jdk [root@xserver1 ~]# cp /opt/docker/jdk/jdk-8u141-linux-x64.tar.gz /home/centos-jdk [root@xserver1 centos-jdk]# cat /home/centos-jdk/dockerfile FROM centos:latest MAINTAINER xiandian WORKDIR /usr/local/java ADD jdk-8u141-linux-x64.tar.gz /usr/local/java RUN ln -s /usr/local/java/jdk1.8.0_141 /usr/local/java/jdk ENV JAVA_HOME /usr/local/java/jdk ENV JRE_HOME ${JAVA_HOME}/jre ENV CLASSPATH .:${JAVA_HOME}/lib:${JRE_HOME}/lib ENV PATH ${JAVA_HOME}/bin:$PATH [root@xserver1 ~]# docker build -t centos-jdk /home/centos-jdk [root@xserver1 ~]# docker run -d -it --rm centos-jdk 十二、swarm集群部署 写出部署swarm集群的主要步骤 1. 主机映射 2. 时间同步 3. 配置Docker API 4. 初始化集群 5. Node节点加入集群
2021年07月04日
333 阅读
0 评论
0 点赞
2021-07-04
Windows11预览版 体验
{mtitle title="Windows11"/} 从 windows xp 到 Windows10,以及现在最新的Windows11,windows的更新。有着时代的缩影,从绿色的开始到圆形的按钮、透视的菱形及最新的四四方方的田字。从视窗系统的便于操作到UI的美化,以及人性的设计。Windows的改变可以说影响了无数的使用者。 从3月份的 20H1 开始Windows就进行了UI的优化,更新以后还有些不适应。Windows11 推送更新在秋季的某天,对于这种开发版有着一种极客精神的我是不能等待的。开发版的产品也需要有着一批先行者,使用途中可能会出现一些问题。对于问题也就`理解万岁`,自己能解决的就自己来,不能的就坐等更新。简单描述一下更新内容:任务栏居中,右键,菜单栏,设置,文件管理器等等。确实加入了很多圆角的UI,也确实好看了很多。(不知道是不是小米log圆角带起的一波浪潮)
2021年07月04日
323 阅读
0 评论
0 点赞
2021-06-21
nginx 基础学习
nginx 默认配置 user www www; #程序运行用户和组 worker_processes auto; #启动进程,指定 nginx 启动的工作进程数量,建议按照 cpu 数目来指定,一般等于 cpu 核心数目 error_log /home/wwwlogs/nginx_error.log crit; #全局错误日志 pid /usr/local/nginx/logs/nginx.pid; #主进程 PID 保存文件 worker_rlimit_nofile 51200; #文件描述符数量 events { use epoll; #使用 epoll 模型,对于 2.6 以上的内核,建议使用 epoll 模型以提高性能 worker_connections 51200; #工作进程的最大连接数量 } http{ #网站优化参数 server { #具体的某一网站的配置信息 listen 80; #监听端口 root html; #网页根目录(/usr/local/nginx/html) server_name www.atguigu.com; #服务器域名 index index.html; #默认加载页面 access_log logs/access.log; #访问日志保存位置 ......; location (.*)\.php$ { 用正则匹配具体的访问对象; } location { 跳转等规则; } } server { 虚拟主机; } } Nginx 的状态统计 1. 安装 nginx 时将 --with-http_stub_status_module 模块开启 2. 修改 nginx 配置文件(写入要访问的 server 标签中) location /nginx_status{ stub_status on; access_log off; } 3. 客户端访问网址:http://IP/nginx_status `Active connections` 表示当前的活动连接数 `server accepts handled requests` 表示已经处理的连接信息 三个数字依次表示已处理的连接数、成功的 TCP 握手次数、已处理的请求数 目录保护 1. 原理和 apache 的目录保护原理一样(利用上一个实验接着完成) 2. 在状态统计的 location 中添加: auth_basic "Welcome to nginx_status!"; auth_basic_user_file /usr/local/nginx/html/htpasswd.nginx; 3. 使用 http 的命令 htpasswd 进行用户密码文件的创建(生成在上面指定的位置) #htpasswd -c /usr/local/nginx/html/htpasswd.nginx user 4. 重启 nginx 并再次访问统计页面 基于 IP 的身份验证(访问控制) 1. 接着上一个实验完成操作 2. 在状态统计的 location 中添加: allow 192.168.88.1; deny 192.168.88.0/24; #仅允许 192.168.88.1 访问服务器 虚拟主机(基于域名) 1. 提前准备好两个网站的域名, 并且规划好两个网站网页存放目录 2. 在 Nginx 主配置文件中并列编写两个 server 标签,并分别写好各自信息 server { listen 80; server_name blog.atguigu.com; index index.html index.htm index.php; root html/blog; access_log logs/blog-access.log main; } server { listen 80; server_name bbs.atguigu.com; index index.html index.htm index.php; root html/bbs; access_log logs/bbs-access.log main; } 3. 分别访问两个不同的域名验证结果 反向代理 1. 在另外一台机器上安装 apache, 启动并填写测试页面 2. 在 nginx 服务器的配置文件中添加(写在某一个网站的 server 标签内) location / { proxy_pass http://192.168.88.100:80; #此处填写 apache 服务器的 IP 地址 } 3. 重启 nginx,并使用客户端访问测试 负载调度 1. 使用默认的 rr 轮训算法,修改 nginx 配置文件 upstream bbs { #此标签在 server 标签前添加 server 192.168.88.100:80; server 192.168.88.200:80; } server { ........; #修改自带的 location / 的标签,将原内容删除,添加下列两项 location / { proxy_pass http://bbs; #添加反向代理,代理地址填写 upstream 声明的名字 proxy_set_header Host $host; #重写请求头部,保证网站所有页面都可访问成功 } } 2. 开启并设置两台 88.100 & 88.200 的主机 安装 apache 并设置不同的 index.html 页面内容(设置不同页面是为了看实验效果) 3. 重启 nginx,并使用客户端访问测试
2021年06月21日
322 阅读
0 评论
0 点赞
1
...
7
8
9
...
16