網站首頁 編程語言 正文
前言
今天發現es日志未記錄,檢查了filebeat、elasticsearch、logstash之后發現es的索引都變成了只讀狀態,手動修改索引模式之后,過幾分鐘又變成了只讀狀態。
進一步翻閱資料,才知道原因是一旦在存儲超過95%的磁盤中的節點上分配了一個或多個分片的任何索引,該索引將被強制進入只讀模式。所以只能擴充磁盤空間了。下面簡單描述下磁盤擴充的步驟。
步驟
磁盤原來已經有兩個分區了,但是分配的空間都不大。
增加磁盤,通過管理端掛載新的磁盤sdc;
使用fdisk /dev/sdc,創建新分區;
[root@localhost indices]# fdisk /dev/sdc Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel Building a new DOS disklabel with disk identifier 0x5799aeba. Changes will remain in memory only, until you decide to write them. After that, of course, the previous content won't be recoverable. Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite) WARNING: The size of this disk is 2.2 TB (2199023255552 bytes). DOS partition table format can not be used on drives for volumes larger than (2199023255040 bytes) for 512-byte sectors. Use parted(1) and GUID partition table format (GPT). WARNING: DOS-compatible mode is deprecated. It's strongly recommended to switch off the mode (command 'c') and change display units to sectors (command 'u'). Command (m for help): n #new 新分區 Command action e extended p primary partition (1-4) p #選擇主扇區 Partition number (1-4): 1 #起始扇區 First cylinder (1-267349, default 1): #這里直接回車表示取默認值1 Using default value 1 Last cylinder, +cylinders or +size{K,M,G} (1-267349, default 267349): #這里由于es需要的存儲空間比較大,所以2個T的空間我都加上了,正常可以按照需求修改扇區大小 Using default value 267349 Command (m for help): w #保存退出 The partition table has been altered! Calling ioctl() to re-read partition table. Syncing disks.
然后創建物理卷,使用pvcreate /dev/sdc1命令;注意:這里很多文章里要求重啟系統,這里其實可以不用重啟,可直接操作,不影響服務器的正常運行;
[root@localhost indices]# pvcreate /dev/sdc1 Physical volume "/dev/sdc1" successfully created
使用vgscan查看 物理卷組 名稱;
[root@localhost indices]# vgscan Reading all physical volumes. This may take a while... Found volume group "VolGroup" using metadata type lvm2 #這里物理卷組名稱為VolGroup
將剛才增加的物理扇區加載到卷組中,這里使用 vgextend VolGroup /dev/sdc1;
[root@localhost indices]# vgextend VolGroup /dev/sdc1 Volume group "VolGroup" successfully extended
增加卷組的大小,這里使用lvextend -L +2048G /dev/mapper/VolGroup-lv_root;
[root@localhost indices]# lvextend -L +2048G /dev/mapper/VolGroup-lv_root Size of logical volume VolGroup/lv_root changed from 135.47 GiB (34681 extents) to 2.13 TiB (558848 extents). Logical volume lv_root successfully resized.
使用df -h查看空間擴充情況,發現空間并未擴充,這是因為文件系統還未同步;
[root@localhost indices]# df -h Filesystem Size Used Avail Use% Mounted on /dev/mapper/VolGroup-lv_root 134G 119G 8.4G 94% / tmpfs 32G 72K 32G 1% /dev/shm /dev/sda1 477M 41M 411M 10% /boot
同步文件系統,使用xfs_growfs或者resize2fs同步文件系統,如下操作;
[root@localhost indices]# resize2fs -f /dev/mapper/VolGroup-lv_root resize2fs 1.41.12 (17-May-2010) Filesystem at /dev/mapper/VolGroup-lv_root is mounted on /; on-line resizing required old desc_blocks = 9, new_desc_blocks = 137 Performing an on-line resize of /dev/mapper/VolGroup-lv_root to 572260352 (4k) blocks. The filesystem on /dev/mapper/VolGroup-lv_root is now 572260352 blocks long.
再使用df -h 查看空間擴容情況
[root@localhost indices]# df -h Filesystem Size Used Avail Use% Mounted on /dev/mapper/VolGroup-lv_root 2.1T 125G 1.9T 7% / tmpfs 32G 72K 32G 1% /dev/shm /dev/sda1 477M 41M 411M 10% /boot
由于CentOS6和CentOS7在默認根文件系統的文件系統格式存在差異,需要判斷是否為xfs,如果是xfs則應該使用xfs_growfs而不是一味的使用resize2fs。
原文鏈接:https://blog.csdn.net/zhangxu51241/article/details/121658809
相關推薦
- 2022-04-20 Python全棧之模板渲染詳解_python
- 2022-10-19 Pandas中Series的創建及數據類型轉換_python
- 2022-11-02 Python嵌套函數與nonlocal使用詳細介紹_python
- 2022-03-20 Android國際化之中英文語言切換_Android
- 2022-05-09 Python的ini配置文件你了解嗎_python
- 2022-12-29 Kotlin使用滾動控件RecyclerView實例教程_Android
- 2022-07-10 詳解transition 被動動畫
- 2022-09-22 git-lfs 離線安裝
- 最近更新
-
- window11 系統安裝 yarn
- 超詳細win安裝深度學習環境2025年最新版(
- Linux 中運行的top命令 怎么退出?
- MySQL 中decimal 的用法? 存儲小
- get 、set 、toString 方法的使
- @Resource和 @Autowired注解
- Java基礎操作-- 運算符,流程控制 Flo
- 1. Int 和Integer 的區別,Jav
- spring @retryable不生效的一種
- Spring Security之認證信息的處理
- Spring Security之認證過濾器
- Spring Security概述快速入門
- Spring Security之配置體系
- 【SpringBoot】SpringCache
- Spring Security之基于方法配置權
- redisson分布式鎖中waittime的設
- maven:解決release錯誤:Artif
- restTemplate使用總結
- Spring Security之安全異常處理
- MybatisPlus優雅實現加密?
- Spring ioc容器與Bean的生命周期。
- 【探索SpringCloud】服務發現-Nac
- Spring Security之基于HttpR
- Redis 底層數據結構-簡單動態字符串(SD
- arthas操作spring被代理目標對象命令
- Spring中的單例模式應用詳解
- 聊聊消息隊列,發送消息的4種方式
- bootspring第三方資源配置管理
- GIT同步修改后的遠程分支