云计算(iscsi共享raid1) lnmp nginx

  1. iscsi共享raid1

准备两台主机:

192.168.10.10

192.168.10.20

添加一块硬盘

 

 

[root@localhost ~]#  rpm -qa | grep target

selinux-policy-targeted-3.13.1-102.el7.noarch

targetcli-2.1.fb41-3.el7.noarch

[root@localhost ~]# systemctl start target

[root@localhost ~]# systemctl enable target

[root@localhost ~]# targetcli

[root@localhost ~]# partprobe /dev/sdb #重新加载硬盘

[root@localhost ~]# pvcreate /dev/sdb2 /dev/sdb3 #创建物理卷

  Physical volume "/dev/sdb2" successfully created.

  Physical volume "/dev/sdb3" successfully created.

[root@localhost ~]# vgcreate vg /dev/sdb2 /dev/sdb3 #创建卷组

  Volume group "vg" successfully created

[root@localhost ~]# lvcreate -L 1G -n l /dev/vg #创建逻辑卷

  Logical volume "l" created.

/> backstores/block/ create reid /dev/vg/l

Created block storage object reid using /dev/vg/l.

/> iscsi/ create iqn.2021-09.com.server.www:reid

Created target iqn.2021-09.com.server.www:reid.

Created TPG 1.

Global pref auto_add_default_portal=true

Created default portal listening on all IPs (0.0.0.0), port 3260.

/> iscsi/iqn.2021-09.com.server.www:reid/tpg1/acls create iqn.2021-09.com.client.www:client1

Created Node ACL for iqn.2021-09.com.client.www:client1

/> iscsi/iqn.2021-09.com.server.www:reid/tpg1/luns create /backstores/block/reid

Created LUN 0.

Created LUN 0->0 mapping in node ACL iqn.2021-09.com.client.www:client1

/> iscsi/iqn.2021-09.com.server.www:reid/tpg1/portals/ delete 0.0.0.0 3260  #删除

Deleted network portal 0.0.0.0:3260

/> iscsi/iqn.2021-09.com.server.www:reid/tpg1/portals create 192.168.10.10 3260 #添加

Using default IP port 3260

Created network portal 192.168.10.10:3260.

客户端

[root@localhost ~]# vim /etc/iscsi/initiatorname.iscsi #配置文件修改

修改为主的client1创建的名称

[root@localhost ~]# systemctl restart iscsid #重启

[root@localhost ~]#  systemctl enable iscsid #加入开机自启

[root@localhost ~]# iscsiadm -m discovery -p 192.168.10.10:3260 -t sendtargets

[root@localhost ~]#  iscsiadm -m node -T iqn.2021-09.com.server.www:reid -l

[root@localhost ~]#

 

LNMP

nginx:192.168.10.10

mariadb:192.168.10.20

php:192.168.10.30

nginx:

[root@localhost ~]# tar -zxf nginx-1.11.5.tar.gz

[root@localhost ~]# cd nginx-1.11.5/

[root@localhost nginx-1.11.5]# yum -y install gcc* pcre pcre-devel openssl-devel openssl zlib zlib-devel

 

[root@localhost nginx-1.11.5]# useradd -M -s /bin/nologin nginx #创建指定目录

[root@localhost nginx-1.11.5]# ./configure --prefix=/usr/local/nginx --user=nginx --group=nginx --with-http_stub_status_module --with-http_ssl_module && make && make install #编译安装

[root@localhost nginx-1.11.5]# ln -s /usr/local/nginx/sbin/* /usr/local/sbin/ #软链接

[root@localhost nginx-1.11.5]# nginx #启动服务

[root@localhost nginx-1.11.5]# netstat -anput | grep nginx #查看端口

tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      16084/nginx: master

[root@localhost nginx-1.11.5]# firefox 192.168.10.10

 

Mariadb:

[root@localhost ~]# yum -y install mariadb*

安装php:

[root@localhost ~]# yum -y install gd libxml2-devel libjpeg-devel libpng-devel libXpm-devel

[root@localhost ~]# tar -zxf php-5.5.38.tar.gz

[root@localhost ~]# cd php-5.5.38/

[root@localhost php-5.5.38]# ./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php --with-gd --with-zlib --with-jpeg-dir=/usr/lib --with-png-dir=/usr/lib --with-mysql=mysqlnd --with-mysqli=mysqlnd --enable-fpm --enable-mbstring && make && make install

[root@localhost php-5.5.38]# cp php.ini-development /usr/local/php/php.ini

[root@localhost php-5.5.38]# vim /usr/local/php/php.ini

[root@localhost php-5.5.38]# cp sapi/fpm/init.d.php-fpm /etc/rc.d/init.d/php-fpm

[root@localhost php-5.5.38]# chmod +x /etc/rc.d/init.d/php-fpm

[root@localhost php-5.5.38]# chkconfig --add php-fpm

[root@localhost php-5.5.38]# cd /usr/local/php/etc/

[root@localhost etc]# cp php-fpm.conf.default php-fpm.conf

[root@localhost etc]# vim php-fpm.conf

[root@localhost etc]# systemctl start php-fpm #重启服务

[root@localhost etc]# netstat -anput | grep 9000 #查看端口

tcp        0      0 192.168.10.30:9000      0.0.0.0:*               LISTEN      118417/php-fpm: mas

nginx:

[root@localhost nginx-1.11.5]# vim /usr/local/nginx/conf/nginx.conf

[root@localhost ~]# mkdir /www

[root@localhost ~]# cd /www/

[root@localhost www]# vim index.php

 

数据库:

[root@localhost ~]# systemctl restart mariadb #启动服务

[root@localhost ~]#  mysql -uroot -p #进入数据库,不需要密码直接进入

Enter password:

MariaDB [(none)]> grant all on *.* to 'root'@'192.168.10.%' identified by "123.com";

Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> flush privileges;

Query OK, 0 rows affected (0.00 sec)

 

[root@localhost www]# firefox 192.168.10.10/index.php

完成!!!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

数据库从删库到跑路

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值