日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

varnish介绍以及虚拟机的封装

發(fā)布時間:2025/3/19 编程问答 29 豆豆
生活随笔 收集整理的這篇文章主要介紹了 varnish介绍以及虚拟机的封装 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

varnish是一款高性能、開源的反向代理服務器和緩存服務器。Varnish使用內存緩存文件來減少響應時間和網(wǎng)絡帶寬消耗。

VCL處理流程圖

處理過程大致分為如下幾個步驟:
(1)Receive 狀態(tài),也就是請求處理的入口狀態(tài),根據(jù) VCL 規(guī)則判斷該請求應該是 Pass 或
Pipe,或者進入 Lookup(本地查詢)。
(2)Lookup 狀態(tài),進入此狀態(tài)后,會在 hash 表中查找數(shù)據(jù),若找到,則進入 Hit 狀態(tài),否則進
入 miss 狀態(tài)。
(3)Pass 狀態(tài),在此狀態(tài)下,會進入后端請求,即進入 fetch 狀態(tài)。
(4)Fetch 狀態(tài),在 Fetch 狀態(tài)下,對請求進行后端的獲取,發(fā)送請求,獲得數(shù)據(jù),并進行本地
的存儲。
(5)Deliver 狀態(tài), 將獲取到的數(shù)據(jù)發(fā)送給客戶端,然后完成本次請求。

varnish 服務配置

基礎環(huán)境配置之封裝虛擬機

1、封裝虛擬機,配置三臺

主機環(huán)境: rhel6 selinux and iptables disabled
兩臺作為后端服務器
apache——172.25.54.x server2
apache——172.25.54.y server3
一臺作為varnish緩存服務器
varnish ——172.25.54.z server1
主機為客戶端clients : 172.25.54.250
注 : 此處操作系統(tǒng)為 rhel6.5

2、安裝虛擬機(作為母盤)

6.5版本鏡像下載鏈接
注意:在安裝虛擬機前,在真機配置好DHCP,以便新建虛擬機存在IP










重啟后的操作

[root@localhost ~]# ip addr 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00inet 127.0.0.1/8 scope host loinet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000link/ether 52:54:00:58:16:d2 brd ff:ff:ff:ff:ff:ffinet 172.25.54.3/24 brd 172.25.54.255 scope global eth0inet6 fe80::5054:ff:fe58:16d2/64 scope link valid_lft forever preferred_lft forever [root@localhost ~]# hostname server ##臨時修改主機名稱 [root@localhost ~]# hostname server [root@localhost ~]# vi /etc/sysconfig/network [root@localhost ~]# cat /etc/sysconfig/network ##永久修改主機名稱 NETWORKING=yes HOSTNAME=server [root@localhost ~]# vi /etc/hosts ##添加后四行內容 [root@localhost ~]# cat /etc/hosts 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 172.25.54.1 server1 172.25.54.2 server2 172.25.54.3 server3 172.25.54.4 server4 [root@localhost ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth0 [root@localhost ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0 DEVICE=eth0 ONBOOT=yes BOOTPROTO="dhcp" [root@localhost ~]# ls /etc/udev/rules.d/ ##刪除目錄/etc/udev/rules.d/下的內容,只留下文件60-raw.rules 60-raw.rules [root@localhost ~]# vi /etc/yum.repos.d/rhel-source.repo [root@localhost ~]# cat /etc/yum.repos.d/rhel-source.repo [rhel-source] name=Red Hat Enterprise Linux $releasever - $basearch - Source baseurl=http://172.25.54.250/rhel6.5 enabled=1 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release [root@localhost ~]# yum clean all Loaded plugins: product-id, subscription-manager This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register. Cleaning repos: rhel-source Cleaning up Everything [root@localhost ~]# yum repolist Loaded plugins: product-id, subscription-manager This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register. rhel-source | 3.9 kB 00:00 rhel-source/primary_db | 3.1 MB 00:00 repo id repo name status rhel-source Red Hat Enterprise Linux 6Server - x86_64 - Source 3,690 repolist: 3,690 [root@localhost ~]# yum install vim lftp -y [root@localhost ~]# vim /etc/sysconfig/selinux [root@localhost ~]# cat /etc/sysconfig/selinux 7 SELINUX=disabled ##修改selinux的值為disabled [root@localhost ~]# chkconfig iptables off [root@localhost ~]# /etc/init.d/iptables stop ##這兩條命令是關閉防火墻 [root@localhost ~]# poweroff ##做完上述操作過后,關閉該虛擬機

注意:母盤關機后,不能再次打開,再次打開會導致母盤損壞

3、虛擬機(子鏡像)的安裝

kvm —> cpu/mem 對cpu和內存的虛擬化
qemu —> disk/net…. 對磁盤 網(wǎng)卡….的虛擬化
libvirtd —-> user 和 kernel 之間的操作接口
virt-manager —–> 虛擬機管理
virsh —–> 虛擬機管理

首先對母盤做以下處理

[root@foundation54 ~]# cd /var/lib/libvirt/images/ [root@foundation54 images]# ll total 1948488 -rw------- 1 root root 21478375424 Jul 28 11:03 tutu.qcow2 [root@foundation54 images]# du -h tutu.qcow2 1.9G tutu.qcow2 [root@foundation54 images]# ls tutu.qcow2 [root@foundation54 images]# virt- virt-admin virt-format virt-resize virt-alignment-scan virt-get-kernel virt-sparsify virt-builder virt-host-validate virt-sysprep virt-cat virt-index-validate virt-tar-in virt-clone virt-inspector virt-tar-out virt-copy-in virt-install virt-top virt-copy-out virt-log virt-viewer virt-customize virt-ls virt-what virt-df virt-make-fs virt-who virt-diff virt-manager virt-who-password virt-edit virt-pki-validate virt-xml virt-filesystems virt-rescue virt-xml-validate [root@foundation54 images]# virt-sysprep -d tutu [root@foundation54 images]# virt-manager

[root@foundation54 images]# pwd /var/lib/libvirt/images [root@foundation54 images]# ls tutu.qcow2 [root@foundation54 images]#

注意:若命令 virt-sysprep 不存在,便執(zhí)行下列操作,執(zhí)行后,該命令便存在啦~

[root@foundation54 ~]# yum provides */virt-sysprep Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-: manager This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register. 1:libguestfs-tools-c-1.32.7-3.el7.x86_64 : System administration tools for: virtual machines Repo : rhel7.3 Matched from: Filename : /usr/bin/virt-sysprep [root@foundation54 ~]# yum install libguestfs-tools-c-1.32.7-3.el7.x86_64 -y

安裝

[root@foundation54 images]# pwd /var/lib/libvirt/images [root@foundation54 images]# ls tutu.qcow2 [root@foundation54 images]# qemu-img create -f qcow2 -b tutu.qcow2 test1 Formatting 'test1', fmt=qcow2 size=21474836480 backing_file='tutu.qcow2' encryption=off cluster_size=65536 lazy_refcounts=off [root@foundation54 images]# ls test1 tutu.qcow2 [root@foundation54 images]# ll test1 -rw-r--r-- 1 root root 197120 Jul 28 11:28 test1 [root@foundation54 images]# du -h test1 196K test1 [root@foundation54 images]# virt-manager

[root@foundation54 images]# du -h test1 4.6M test1 [root@foundation54 images]# du -h tutu.qcow2 1.9G tutu.qcow2 [root@foundation54 images]#

虛擬機(子鏡像)的所有操作均不改變虛擬機母盤
按照此方法繼續(xù)安裝虛擬機test2、test3
varnish ——172.25.54.5 server1(虛擬機test1)
apache——172.25.54.6 server2(虛擬機test2)
apache——172.25.54.7 server3(虛擬機test3)

總結

以上是生活随笔為你收集整理的varnish介绍以及虚拟机的封装的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內容還不錯,歡迎將生活随笔推薦給好友。