AWS 基础服务学习
AWS 學習筆記
Amazon EFS
Amazon EFS是一種彈性文件系統,可提供簡單、可擴展、完全托管的彈性 NFS 文件系統。關于NFS可以了簡單理解為網絡磁盤分區。
1.關于NFS
NFS最大的功能就是可以透過網絡,讓不同的機器、不同的操作系統、可以彼此分享網絡上的某個文件系統。 NFS可以讓你的PC連接遠程的NFS服務器上分享的目錄,并掛載到本地端的PC中。就以window系統打個例子:
遠程的NFS服務器上分享了一個目錄,姑且叫做Z盤啦。現在本地PC通過NFS可以將遠端的NFS服務器上分享的目錄掛在到本地上命名為U的磁盤上(名字自定義)。在本地端的PC看起來,那個遠程主機的目錄就好像是自己的一個磁盤分區槽一樣!用起來跟你PC上插入的U盤一樣!重點是這個共享的目錄可以供給多臺計算機一起使用。下面的圖片可以很好地解析:
2.創建Amazon EFS
Amazon EFS可以在控制臺或 AWS CLI 創建文件系統,還可以用編程的方式訪問,如:AWS SDKs 或 Amazon EFS API。
2.1 EFS API CreateFileSystem
關于Amazon EFS創建文件系統的API官方解析在這里:https://docs.aws.amazon.com/zh_cn/efs/latest/ug/API_CreateFileSystem.html
2.2 CLI
關于使用AWS CLI,官方提供的小案例:例如,以下 create-file-system 命令在 us-west-2 AWS 區域創建一個文件系統。該命令指定 MyFirstFS 作為創建令牌。
$ aws efs create-file-system \ --creation-token MyFirstFS \ --performance-mode generalPurpose \ --throughput-mode bursting \ --region us-west-2 \ --tags Key=Name,Value="Test File System" Key=developer,Value=rhoward \ --profile adminuser這里定義了令牌,性能模式(creation-token),吞吐量模式(throughput-mode),區域(region),標簽(tags).
3. 刪除EFS
3.1 CLI
要刪除EFS要兩大步:
- 刪除掛載目標
- 刪除文件系統
刪除掛載目標
用describe-file-systems查詢文件系統列表,用describe-mount-targets查詢掛載點,用delete-mount-target刪除掛載點
$ aws efs describe-file-systems \ --profile adminuser \ --region aws-region$ aws efs describe-mount-targets \ --file-system-id file-system-ID \ --profile adminuser \ --region aws-region$ aws efs delete-mount-target \ --mount-target-id ID-of-mount-target-to-delete \ --profile adminuser \ --region aws-region刪除文件系統
用delete-file-system刪除文件系統
$ aws efs delete-file-system \ --file-system-id ID-of-file-system-to-delete \ --region aws-region \ --profile adminuser4. 掛載EFS
4.1 CLI
直接掛載
用create-mount-target創建掛載目標,用describe-mount-targets查詢掛載目標,linux端用mount命令掛載
$ aws efs create-mount-target \ --file-system-id file-system-id \ --subnet-id subnet-id \ --security-group ID-of-the-security-group-created-for-mount-target \ --region aws-region \ --profile adminuser$ aws efs describe-mount-targets \ --file-system-id file-system-ID \ --profile adminuser \ --region aws-region$ sudo mount \ -t nfs \ -o nfsvers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2,noresvport \ mount-target-DNS:/ ~/efs-mount-point通過EFS 訪問點掛載
$ aws efs create-access-point --file-system-id fs-01234567 --client-token 010102020-3$ sudo mount -t efs -o tls,accesspoint=access-point-id file-system-id efs-mount-point5.修改掛載目標安全組
5.1 CLI
用modify-mount-target-security-groups修改掛載目標安全組,每個掛載目標都會有關聯的網絡接口,該操作就是修改網絡接口的安全組
$ aws efs modify-mount-target-security-groups \ --mount-target-id mount-target-ID-whose-configuration-to-update \ --security-groups security-group-ids-separated-by-space \ --region aws-region-where-mount-target-exists \ --profile adminuser6. EFS 訪問點
訪問點 是 EFS 文件系統中特定于應用程序的入口點,便于輕松地管理應用程序對共享數據集的訪問。訪問點還可以為文件系統強制執行不同的根目錄,以便客戶端只能訪問指定目錄或其子目錄中的數據。
用create-access-point創建訪問點,用delete-access-point刪除訪問點。
aws efs create-access-point \ --file-system-id fs-01234567 \ --client-token 010102020-3aws efs delete-access-point \ --access-point-id fsap-092e9f80b3fb5e6f3 \ --client-token 010102020-3AWS FSx
Amazon FSx 通過為工作負載提供本機兼容性和功能集(如基于 Microsoft Windows 的存儲、高性能計算、機器學習和電子設計自動化),提供了完全托管的第三方文件系統。Amazon FSx 支持兩種文件系統類型:Lustre 和 Windows File Server。
1. 關于Lustre
Lustre是一個開源、分布式并行文件系統軟件平臺,具有高可擴展、高性能、高可用等特點。Lustre的可伸縮體系結構具有三個主要組成部分。元數據服務器,對象存儲服務器和客戶端。
官網的架構圖:
- MGS(Management Server),MGS存儲集群中的所有Lustre文件的配置信息,并為其它Lustre組件提供信息。
- MDS(Metadata Servers),MDS存儲元數據,每個MDS管理Lustre文件系統中的名稱和目錄。
- OSS(Object Storage Servers),OSS用于存放客戶端業務訪問數據。
制作MDT
mkfs.lustre \ --mdt \ --index=0 \ --fsname=lustre \ --failnode=xxx.xxx.xxx.xx@tcp \ --mgsnode=xxx.xxx.xxx.xx@tcp \ --mgsnode=xxx.xxx.xxx.xx@tcp \ --reformat \ --verbose \ /dev/mapper/mdt制作MGT
mkfs.lustre \ --mdt \ --index=0 \ --fsname=lustre \ --failnode=xxx.xxx.xxx.xx@tcp \ --mgsnode=xxx.xxx.xxx.xx@tcp \ --mgsnode=xxx.xxx.xxx.xx@tcp \ --reformat \ --verbose \ /dev/mapper/mgt制作OST
mkfs.lustre \ --ost \ --index=0 \ --fsname=lustre \ --failnode=xxx.xxx.xxx.xx@tcp \ --mgsnode=xxx.xxx.xxx.xx@tcp \ --mgsnode=xxx.xxx.xxx.xx@tcp \ --reformat \ --verbose \ /dev/mapper/OST0001其他就不繼續討論了,核心不是介紹Lustre
2.使用FSx for Lustre
2.1關于創建Amazon FSx for Lustre
https://docs.aws.amazon.com/zh_cn/fsx/latest/LustreGuide/getting-started-step1.html
2.2關于安裝Lustre客戶端
如上面的Lustre組件圖一樣,想要使用Amazon FSx for Lustre 文件系統,首先安裝開源Lustre客戶端。這里截取官方提供的AmazonLinux2的安裝方法,更多安裝方法:https://docs.aws.amazon.com/zh_cn/fsx/latest/LustreGuide/install-lustre-client.html
#查看內核 uname -r#跟新內核 #4.14.104-95.84.amzn2.x86_64 基于x86的EC2實例, #或4.14.181-142.260.amzn2.aarch64 或更高可以跳過步驟 sudo yum -y update kernel && sudo reboot#安裝客戶端 sudo amazon-linux-extras install -y lustre2.102.3客戶機上掛載Lustre
更平常掛載一樣,使用mount命令,如:
sudo mount -t lustre -o noatime,flock file_system_dns_name@tcp:/mountname /mnt/fsx查看
dfAWS Config
AWS Config 提供了關于您的 AWS 賬戶中 AWS 資源配置的詳細信息。通過AWS Config我們可以很好得監控AWS賬號中的資源使用,對AWS資源進行監控。隨著對應用程序的需求的不斷增加,記錄您的 AWS 資源的需求也在不斷增加。AWS Config 可以幫助您監督自己的應用程序資源。
AWS Config在以下情況可以幫助你進行資源監控:
- 資源管理
- 審計與合規性
- 對配置更改進行管理與故障排除
AWS Config
AWS Config 提供了關于您的 AWS 賬戶中 AWS 資源配置的詳細信息。通過AWS Config我們可以很好得監控AWS賬號中的資源使用,對AWS資源進行監控。隨著對應用程序的需求的不斷增加,記錄您的 AWS 資源的需求也在不斷增加。AWS Config 可以幫助您監督自己的應用程序資源。
AWS Config在以下情況可以幫助你進行資源監控:
- 資源管理
- 審計與合規性
- 對配置更改進行管理與故障排除
- 安全分析
總結
以上是生活随笔為你收集整理的AWS 基础服务学习的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 瓷砖十大品牌排名(中国十大瓷砖品牌排行)
- 下一篇: 大年初一有什么风俗 吃斋