Advertisement
nhanle

Untitled

Sep 14th, 2017
419
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.37 KB | None | 0 0
  1. Bài: Thiết Lập File Server Resource Manager
  2.  
  3. - Mục tiêu
  4. + Filter dữ liệu ở trên thư mục được chia sẻ
  5. + Thực hiện Shared Folder
  6.  
  7. - Sơ đồ bài thực hành
  8. + Máy chủ Window Server 2012: 192.168.201.201
  9. + Máy Ubuntu Desktop : 192.168.201.200
  10. + Máy Window 10 : 192.168.201.21
  11.  
  12.  
  13. - Các bước chính
  14. 1. Cài đặt File Server Resource Manager
  15. 2. Thực hiện chia sẻ thư mục kết hợp FSRM
  16. 3. Thực hiện đồng bộ dữ liệu giữa Window Linux
  17.  
  18.  
  19. 1. Cài đặt File Server Resource Manager
  20.  
  21. - Tạo File Group "Danh_Sach_File_Cho_Phep"
  22. -IncludePattern: định nghĩa các mẫu file bị CẤM
  23. -ExcludePattern: định nghĩa các mẫu file không bị CẤM
  24.  
  25. new-FsrmFileGroup -Name "Danh_Sach_File_Cho_Phep" -IncludePattern "*.*" -ExcludePattern @("*.bmp","*.jpg","*.gif","*.jpeg","*.tiff","*.png","*.eps","*.tif","*.txt","*.text","*.pdf","*.xls","*.xlsx","*.doc","*.docx","*.ppt","*.pptx","*.pub","*.pubx","*.mpp","*.mdb","*.pst","*.msg","*.wmv","*.mov","*.wav","*.vss","*.vsd","*.fmp12","*.ppsx","*.ldb","*.avi","*.tmp","*.log")
  26.  
  27. - Tạo Template "Template_Danh_Sach_File_Cho_Phep"
  28.  
  29. New-FsrmFileScreenTemplate -Name "Template_Danh_Sach_File_Cho_Phep" –IncludeGroup "Danh_Sach_File_Cho_Phep" -Notification $Notification -Active
  30.  
  31. 2. Thực hiện chia sẻ thư mục kết hợp FSRS
  32.  
  33. - Kiểm tra các user đang có trong máy
  34.  
  35. C:\Users\Administrator>net user
  36.  
  37. - Tạo thêm local group "hocvien"
  38.  
  39. C:\Users\Administrator>net localgroup hocvien /add
  40.  
  41. - Tạo thêm 2 người dùng lần lượt là student và sinhvien
  42.  
  43. C:\Users\Administrator>net user student 123abc!!! /add
  44.  
  45. C:\Users\Administrator>net user sinhvien 123abc!!! /add
  46.  
  47. - Thực hiện thêm 2 người dùng này vào group hocvien
  48.  
  49. C:\Users\Administrator>net localgroup hocvien student sinhvien /add
  50.  
  51.  
  52. 3. Thực hiện đồng bộ dữ liệu giữa Window Linux
  53.  
  54. - Mục tiêu sử dụng các công cụ có sẵn trong hệ điều hành Window và Linux để dự phòng cho dữ liệu
  55. + Máy Ubuntu Linux: 192.168.201.200
  56. + Máy Window Server 2012: 192.168.201.201
  57. + Tạo file scripts "Mount_Rsync.sh" có nội dung như sau
  58.  
  59. - Nếu như ta sử dụng máy Ubuntu thì cần phải cài đặt "cifs-utils"
  60.  
  61. nhanld@vmware:~$ sudo apt-get install cifs-utils
  62.  
  63. nhanld@vmware:~$ vi /Mount_Rsync.sh
  64. #!/bin/sh
  65.  
  66. #Khai Bao Thong So Dang Nhap
  67. username='administrator'
  68. password='123abc!!!'
  69.  
  70. #Ket Noi Shared Folder May Chu Window
  71. MayChu='192.168.201.201'
  72. Shared='Shared'
  73.  
  74. #Kiem Tra Ket Noi
  75. GiaTri=0
  76. bash -c "exec 6<>/dev/tcp/$MayChu/445" && GiaTri=1
  77.  
  78. if [ $GiaTri eq 1 ] then
  79. #Ket Noi Shared File Sang May Chu
  80. mkdir -p /mnt/Shared
  81. mount -t cifs //$MayChu/$Shared /mnt/Shared -o username=$username,password=$password
  82.  
  83.  
  84. #Thuc Hien Rsync voi Folder Cuc Bo
  85. mkdir -p /mnt/Backup
  86. rsync -auv --delete /mnt/Shared/ /mnt/Backup
  87.  
  88. #Tat Shared File Den May Chu
  89. umount /mnt/Shared
  90. fi
  91.  
  92. - Gán thêm quyền thực thi cho scripts và thử nghiệm kích hoạt scripts
  93.  
  94. nhanld@vmware:~$ sudo chmod +x /Mount_Rsync.sh
  95. nhanld@vmware:~$ sh /Mount_Rsync.sh
  96.  
  97. - Sử dụng công cụ Crontab để lập lịch cho scritps chạy
  98.  
  99. root@vmware:~# vi /etc/crontab
  100. #mot phut chay scripts
  101. * * * * * root sh /Mount_Rsync.sh
  102.  
  103. #mot phut chay scripts
  104. */30 * * * * root sh /Mount_Rsync.sh
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement