美文网首页
阿里云实践tomcat

阿里云实践tomcat

作者: linux_龍 | 来源:发表于2019-10-03 15:01 被阅读0次

1.下载软件

tree   vim wget  bash-completion  bash-completion-extras  lrzsz  net-tools sysstat  iotop iftop htop unzip nc nmap telnet bc  psmisc httpd-tools  bind-utils nethogs

查看磁盘占用情况

[root@oldboy-web ~]# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/vda1        40G  1.8G   36G   5% /
devtmpfs        486M     0  486M   0% /dev
tmpfs           496M     0  496M   0% /dev/shm
tmpfs           496M  492K  496M   1% /run
tmpfs           496M     0  496M   0% /sys/fs/cgroup
tmpfs           100M     0  100M   0% /run/user/0

生成文件

[root@oldboy-web ~]# dd if=/dev/zero  of=/tmp/500m   bs=1M count=500 
500+0 records in
500+0 records out
524288000 bytes (524 MB) copied, 2.35712 s, 222 MB/s

生成文件

[root@oldboy-web ~]# dd if=/dev/zero  of=/tmp/1000m   bs=1M count=1000 
1000+0 records in
1000+0 records out
1048576000 bytes (1.0 GB) copied, 5.92911 s, 177 MB/s

查看内存占用情况

[root@oldboy-web ~]# free  -h
              total        used        free      shared  buff/cache   available
Mem:           991M         85M         68M        492K        836M        749M
Swap:            0B          0B          0B

查看磁盘分区信息

[root@oldboy-web ~]# fdisk -l

Disk /dev/vda: 42.9 GB, 42949672960 bytes, 83886080 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x000b2d99

   Device Boot      Start         End      Blocks   Id  System
/dev/vda1   *        2048    83875364    41936658+  83  Linux

Disk /dev/vdb: 21.5 GB, 21474836480 bytes, 41943040 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

挂载

[root@oldboy-web ~]# mount /dev/vdb  /mnt/
mount: /dev/vdb is write-protected, mounting read-only
mount: unknown filesystem type '(null)'

格式化文件系统

[root@oldboy-web ~]# mkfs.xfs   /dev/vdb     
meta-data=/dev/vdb               isize=512    agcount=4, agsize=1310720 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=1        finobt=0, sparse=0
data     =                       bsize=4096   blocks=5242880, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=1
log      =internal log           bsize=4096   blocks=2560, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0

挂载

[root@oldboy-web ~]# mount /dev/vdb  /mnt/
[root@oldboy-web ~]# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/vda1        40G  3.3G   35G   9% /
devtmpfs        486M     0  486M   0% /dev
tmpfs           496M     0  496M   0% /dev/shm
tmpfs           496M  492K  496M   1% /run
tmpfs           496M     0  496M   0% /sys/fs/cgroup
tmpfs           100M     0  100M   0% /run/user/0
/dev/vdb         20G   33M   20G   1% /mnt

创建文件

[root@oldboy-web ~]# touch /mnt/big 

查看下文件

[root@oldboy-web ~]# ll /mnt/
total 0
-rw-r--r-- 1 root root 0 Sep  3 12:15 big

安装JDK

java-1.8.0-openjdk

下载软件mariadb-server nfs-utils jdk

yum install -y mariadb-server  nfs-utils  
yum install  java-1.8.0-openjdk  -y
wget -P /app/tools http://mirrors.tuna.tsinghua.edu.cn/apache/tomcat/tomcat-8/v8.5.45/bin/apache-tomcat-8.5.45.tar.gz

部署jpress 启动数据库服务

systemctl start mariadb-server
设置开机自启动
systemctl enable mariadb-server
MariaDB [(none)]> create database   jpress default charset utf8;
Query OK, 1 row affected (0.00 sec)

MariaDB [(none)]> grant all on jpress.* to jpress@'localhost'  identified by '123456';
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> grant all on jpress.* to jpress@'172.16.1.%'  identified by '123456';
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> select host,user from mysql.user;
+------------+--------+
| host       | user   |
+------------+--------+
| 127.0.0.1  | root   |
| 172.16.1.% | jpress |
| ::1        | root   |
| localhost  |        |
| localhost  | jpress |
| localhost  | root   |
| oldboy-web |        |
| oldboy-web | root   |
+------------+--------+
8 rows in set (0.00 sec)

MariaDB [(none)]> select user,host from mysql.user;
+--------+------------+
| user   | host       |
+--------+------------+
| root   | 127.0.0.1  |
| jpress | 172.16.1.% |
| root   | ::1        |
|        | localhost  |
| jpress | localhost  |
| root   | localhost  |
|        | oldboy-web |
| root   | oldboy-web |
+--------+------------+
8 rows in set (0.00 sec)

MariaDB [(none)]> drop user  ''@'localhost';
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> drop user  ''@'oldboy-web';
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.00 sec)

设置开机自启动tomcat

[root@web02 /etc/rc.d]# cat rc.local
#!/bin/bash
# THIS FILE IS ADDED FOR COMPATIBILITY PURPOSES
#
# It is highly advisable to create own systemd services or udev rules
# to run scripts during boot instead of using this file.
#
# In contrast to previous versions due to parallel execution during boot
# this script will NOT be run after all other services.
#
# Please note that you must run 'chmod +x /etc/rc.d/rc.local' to ensure
# that this script will be executed during boot.

touch /var/lock/subsys/locali
/app/tomcat/bin/startup.sh

相关文章

网友评论

      本文标题:阿里云实践tomcat

      本文链接:https://www.haomeiwen.com/subject/imvhyctx.html