网站首页 > 技术文章 正文
【三】建立本地盘和共享盘
3.1 添加本地磁盘(动态)
Node1:
添加20G本地盘(/u01),添加磁盘虚拟机需要处于关闭状态。
[root@tim1 ~]# shutdown -h now
添加SCSI盘,注意规范,磁盘叫node1-disk2.vdi,放在/RAC/node1的目录下。
Node2:同上
3.2 添加共享盘(固定)
1)建立共享磁盘
Node1:
注意规范,磁盘叫sharedisk.vdi,放在/RAC/sharedisk的目录下。
设置为可共享。
2)识别共享盘
Node2:
3)验证共享盘,启动两节点,node1先启动,node2随后再启动。
检查两节点都能看到同一块共享盘
[root@tim1 ~]# ls -al /dev/sd*
[root@tim2 ~]# ls -al /dev/sd*
sda表示第一块磁盘
sda1表示第一块磁盘的第一个分区
sda2表示第一块磁盘的第二个分区
sdb表示第二块磁盘
sdc 表示第三块磁盘
3.3分区并格式化本地盘(这就是/u01)
Node1:
整个一个区都给它:
[root@tim1 ~]# fdisk /dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.
The number of cylinders for this disk is set to 2610.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-2610, default 1): enter
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-2610, default 2610):
Using default value 2610
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
Node2:同上
3.4分配共享盘
共10个分区(1+1+1)+(5+5)+(4+4)+(3+3+3)=30G
Node1:
[root@tim1 ~]# fdisk /dev/sdc
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.
The number of cylinders for this disk is set to 3916.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-3916, default 1): enter
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-3916, default 3916): +1G
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (124-3916, default 124):enter
Using default value 124
Last cylinder or +size or +sizeM or +sizeK (124-3916, default 3916): +1G
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 3
First cylinder (247-3916, default 247):enter
Using default value 247
Last cylinder or +size or +sizeM or +sizeK (247-3916, default 3916): +1G
Command (m for help): n
Command action
e extended
p primary partition (1-4)
e 开始扩展分区
Selected partition 4
First cylinder (370-3916, default 370):enter
Using default value 370
Last cylinder or +size or +sizeM or +sizeK (370-3916, default 3916): enter
Using default value 3916
Command (m for help): n
First cylinder (370-3916, default 370):enter
Using default value 370
Last cylinder or +size or +sizeM or +sizeK (370-3916, default 3916): +5G
Command (m for help): n
First cylinder (979-3916, default 979):enter
Using default value 979
Last cylinder or +size or +sizeM or +sizeK (979-3916, default 3916): +5G
Command (m for help): n
First cylinder (1588-3916, default 1588):enter
Using default value 1588
Last cylinder or +size or +sizeM or +sizeK (1588-3916, default 3916): +4G
Command (m for help): n
First cylinder (2075-3916, default 2075):enter
Using default value 2075 enter
Last cylinder or +size or +sizeM or +sizeK (2075-3916, default 3916): +4G
Command (m for help): n
First cylinder (2562-3916, default 2562):enter
Using default value 2562
Last cylinder or +size or +sizeM or +sizeK (2562-3916, default 3916): +3G
Command (m for help): n
First cylinder (2928-3916, default 2928):enter
Using default value 2928
Last cylinder or +size or +sizeM or +sizeK (2928-3916, default 3916): +3G
Command (m for help): n
First cylinder (3294-3916, default 3294): enter
Using default value 3294
Last cylinder or +size or +sizeM or +sizeK (3294-3916, default 3916): +3G
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
Node2: 不需做共享分区,能看到共享盘就行了。
两个节点看到磁盘分区是一模一样的,如果Node2看不到盘,可能需要查探一下。
[root@tim2 dev]# partprobe /dev/sdc
3.5将本地盘/dev/sdb1分别格式化,然后自动挂载:
Node1:
[root@tim1 ~]# mkfs.ext3 /dev/sdb1
[root@tim1 ~]# mount /dev/sdb1 /u01
[root@tim3 ~]# df
[root@tim1 ~]# vi /etc/fstab
最后一行添加,下次启动有效:
/dev/sdb1 /u01 ext3 defaults 0 0
Node2:同上
【注】:/etc/fstab描述一定要正确,否则启动无法完成。
3.6添加swap分区
Node1:
swap分区大小的设置:一般要求为内存的2倍。
[root@tim1 ~]# free –m 查看内存空间分配
[root@tim1 ~]# df –h 查看磁盘空间分配
[root@tim1 ~]# ls –al /u01 查看/u01下文件信息
1)先用dd命令生成一个空文件,把它放在/u01下,单位1024m,设置2G。
【注】:新添swap不要放到根目录消耗根空间,另外bs的单位M要大写,名字随便。
[root@tim1 ~]# dd if=/dev/zero of=/u01/swap1 bs=1M count=2048
2)创建一个swap类型文件。
[root@tim1 ~]# mkswap /u01/swap1
3)将swpf1生成swap文件。
[root@tim1 ~]# swapon /u01/swap1
查看一下,swap1起作用了。
[root@tim1 ~]# free –m
4)实现开机后自动使用新添的swap1分区。
[root@tim1 ~]# vi /etc/fstab
添加swap行
/u01/swap1 swap swap defaults 0 0
5)修改tmpfs行。
tmpfs /dev/shm tmpfs defaults,size=2G 0 0
6)tmpfs重置一下,使其当下有效。
[root@tim1 ~]# mount -o remount /dev/shm
tmpfs一般设为交换区大小的一半。
Node2:同上
3.7检测配置状态。
the end !!!
@jackman 共筑美好!
猜你喜欢
- 2024-11-11 Oracle 11gR2 RAC 安装流程 - 2 oracle rac安装步骤
你 发表评论:
欢迎- 615℃几个Oracle空值处理函数 oracle处理null值的函数
- 608℃Oracle分析函数之Lag和Lead()使用
- 595℃0497-如何将Kerberos的CDH6.1从Oracle JDK 1.8迁移至OpenJDK 1.8
- 592℃Oracle数据库的单、多行函数 oracle执行多个sql语句
- 587℃Oracle 12c PDB迁移(一) oracle迁移到oceanbase
- 580℃【数据统计分析】详解Oracle分组函数之CUBE
- 569℃最佳实践 | 提效 47 倍,制造业生产 Oracle 迁移替换
- 560℃Oracle有哪些常见的函数? oracle中常用的函数
- 最近发表
-
- PageHelper - 最方便的 MyBatis 分页插件
- 面试二:pagehelper是怎么实现分页的,
- MyBatis如何实现分页查询?(mybatis-plus分页查询)
- SpringBoot 各种分页查询方式详解(全网最全)
- 如何在Linux上运行exe文件,怎么用linux运行windows软件
- 快速了解hive(快速了解美国50个州)
- Python 中的 pyodbc 库(pydbclib)
- Linux搭建Weblogic集群(linux weblogic部署项目步骤)
- 「DM专栏」DMDSC共享集群之部署(一)——共享存储配置
- 故障分析 | MySQL 派生表优化(mysql pipe)
- 标签列表
-
- 前端设计模式 (75)
- 前端性能优化 (51)
- 前端模板 (66)
- 前端跨域 (52)
- 前端缓存 (63)
- 前端aes加密 (58)
- 前端脚手架 (56)
- 前端md5加密 (54)
- 前端路由 (61)
- 前端数组 (73)
- 前端js面试题 (50)
- 前端定时器 (59)
- 前端获取当前时间 (50)
- Oracle RAC (76)
- oracle恢复 (77)
- oracle 删除表 (52)
- oracle 用户名 (80)
- oracle 工具 (55)
- oracle 内存 (55)
- oracle 导出表 (62)
- oracle约束 (54)
- oracle 中文 (51)
- oracle链接 (54)
- oracle的函数 (58)
- 前端调试 (52)
本文暂时没有评论,来添加一个吧(●'◡'●)