openafs服务器配置

这是我的原创如果转贴请说明来源(
rayter.cublog.cn
) 欢迎大家和我一起交流afs文件系统(
rayter_yu@163.com


由于最近工作的原因 需要配置afs文件系统,发现afs相关的资料好少啊 特此写一篇我自己的配置心得希望对喜欢afs文件系统的人能有所帮助
                                              --- rayter
安装主服务器
在磁盘上建立分区 /vicepa, /vicepb
启动bos服务

# /usr/afs/bin/bosserver -noauth &
确定BOS服务器建立了/usr/vice/etc/CellServDB 以及 /usr/vice/etc/ThisCell 两个文件
执行bos setcellname来创建一个Cell

# bos setcellname   -noauth
 
启动资料库服务程序
#bos create  kaserver simple /usr/afs/bin/kaserver -cell  -noauth 创建认证服务器,启动kaserver 进程
 
#bos create  buserver simple /usr/afs/bin/buserver -cell  -noauth 创建备份服务器,启动buserver 进程
 
#bos create  ptserver simple /usr/afs/bin/ptserver -cell  -noauth 创建保护服务器,启动ptserver 进程
 
#bos create  vlserver simple /usr/afs/bin/vlserver -cell  -noauth 创建卷定位(VL)服务器,启动vlserver 进程
 
使用 bos status 這個指令來檢查是不是所有服务器都在執行中:
# /usr/afs/bin/bos status  -noauth
 

Instance kaserver, currently running normally.
 
Instance buserver, currently running normally.
 
Instance ptserver, currently running normally.
 
Instance vlserver, currently running normally.
 
进入kas模式
# /usr/afs/bin/kas -cell  -noauth
 
ka> create afs
 
initial_password:
 
Verifying, please re-enter initial_password:
 
ka> create admin
initial_password:
Verifying, please re-enter initial_password:
ka> examine afs
 
User data for afs
 
key (0) cksum is 2651715259, last cpw: Mon Jun  4 20:49:30 2001
 
  password will never expire.
 
  An unlimited number of unsuccessful authentications is permitted.
 
  entry never expires.  Max ticket lifetime 100.00 hours.
 
  last mod on Mon Jun  4 20:49:30 2001 by
 
  permit password reuse
 
ka> setfields admin -flags admin
 
ka> examine admin
 
User data for admin (ADMIN)
 
  key (0) cksum is 2651715259, last cpw: Mon Jun  4 20:49:59 2001
 
  password will never expire.
 
  An unlimited number of unsuccessful authentications is permitted.
 
  entry never expires.  Max ticket lifetime 25.00 hours.
 
  last mod on Mon Jun  4 20:51:10 2001 by $lt;none>
 
  permit password reuse
 
ka>quit
 
 
執行 bos adduser 指令來將 admin 使用者加入至 /usr/afs/etc/UserList
# /usr/afs/bin/bos adduser  admin -cell  -noauth
 
通过 bos addkey 命令來定義 /usr/afs/etc/KeyFile 中的 AFS 服务器的Key
# /usr/afs/bin/bos addkey   -kvno 0 -cell  -noauth
 
    input key:
 
    Retype input key:
 
使用 pts createuser 指令來建立管理員的保護資料庫紀錄
# /usr/afs/bin/pts createuser -name admin -cell  -noauth
 
执行pts adduser命令将admin用户加入system:administrators群組,然後使用 pts membership 來檢查成員
# /usr/afs/bin/pts adduser admin system:administrators -cell  -noauth
 
# /usr/afs/bin/pts membership admin -cell  -noauth
      Groups admin (id: 1) is a member of:
 
        system:administrators
 
重新啟動所有 AFS 伺服器程序
# /usr/afs/bin/bos restart  -all -cell  -noauth
 
使用 bos create 命令启动文件服务器组件(fs process)
# /usr/afs/bin/bos create  fs fs /usr/afs/bin/fileserver  /usr/afs/bin/volserver /usr/afs/bin/salvager
-cell afs.server -noauth
 
確定所有程序都在執行
# /usr/afs/bin/bos status  -long -noauth
 
Instance kaserver, (type is simple) currently running normally.
 
     Process last started at Mon Jun  4 21:07:17 2001 (2 proc starts)
 
     Last exit at Mon Jun  4 21:07:17 2001
     Command 1 is '/usr/afs/bin/kaserver'
 
Instance buserver, (type is simple) currently running normally.
     Process last started at Mon Jun  4 21:07:17 2001 (2 proc starts)
 
     Last exit at Mon Jun  4 21:07:17 2001
 
     Command 1 is '/usr/afs/bin/buserver'
Instance ptserver, (type is simple) currently running normally.
     Process last started at Mon Jun  4 21:07:17 2001 (2 proc starts)
     Last exit at Mon Jun  4 21:07:17 2001
     Command 1 is '/usr/afs/bin/ptserver'
Instance vlserver, (type is simple) currently running normally.
     Process last started at Mon Jun  4 21:07:17 2001 (2 proc starts)
     Last exit at Mon Jun  4 21:07:17 2001
     Command 1 is '/usr/afs/bin/vlserver'
Instance fs, (type is fs) currently running normally.
     Auxiliary status is: file server running.
     Process last started at Mon Jun  4 21:09:30 2001 (2 proc starts)
     Command 1 is '/usr/afs/bin/fileserver'
     Command 2 is '/usr/afs/bin/volserver'
     Command 3 is '/usr/afs/bin/salvager'
啟動更新伺服器的分配
/usr/afs/bin/bos create
                    upserver simple "/usr/afs/bin/upserver
                    -crypt /usr/afs/etc -clear /usr/afs/bin"
                    -cell  -noauth
完成!!!
创建一个卷来看看吧
vos create   root.cell
安装附加服务器
启动bos服务
# /usr/afs/bin/bosserver -noauth &

启动“更新服务器”客户机
#bos create  upclientetc simple  \
         "/usr/afs/bin/upclient   \
         /usr/afs/etc" -cell  -noauth

启动 fs 进程,该进程连接了文件服务器、卷服务器和挽救器
#bos create  fs fs \
         /usr/afs/bin/fileserver /usr/afs/bin/volserver  \
         /usr/afs/bin/salvager -cell  -noauth
完成!!!

安装附客户机

安装客户机器非常简单了 需要的布步骤是 创建目录 /afs  /usr/vice
#mkdir /afs    #mkdir /usr/vice

创建cache目录  /usr/vice/cache
#mkdir /usr/vice/cache

将服务器上生成的两个配置文件 copy到 /usr/vice/etc 下
CellServDB ThisCell 这个文件就是了

创建一个cache的配置文件 cacheinfo同样也放到 /usr/vice/etc 下 内容如下
/afs:/usr/vice/cache:100000

/afs 就是我mount后的根了  /usr/vice/cache 就是客户端缓存的目录了 100000就是缓存的大小了

之后插入模块
insmod libafs-XX.XX.ko
然后mount到服务器上

afsd -dynroot -fakestat

大功告成

需要注意的是 这样mount后 他会寻找 服务器上的 root.cell这个卷 别忘了在服务器上创建这个卷哦
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
AFS(Andrew File System)是一个分布式文件系统,它提供了一个类似于本地文件系统的接口,允许用户通过网络访问分布在不同地理位置的文件。本文将介绍如何在 CentOS 7 上部署 AFS 平台。 ## 环境准备 在开始之前,确保您具备以下条件: - 一台运行 CentOS 7 系统的服务器,可以是物理服务器或虚拟机。 - 一个具有 root 权限的用户账号。 - 配置了静态 IP 地址。 ## 安装基本依赖 首先,我们需要安装一些必要的软件包,以便我们能够成功地安装和配置 AFS。使用以下命令安装基本依赖: ``` yum install -y epel-release yum install -y krb5-server krb5-libs krb5-workstation openafs openafs-client pam_krb5 ``` ## 配置 Kerberos Kerberos 是一个网络身份验证协议,它用于在计算机网络中进行身份验证。在 AFS 中,我们使用 Kerberos 进行身份验证。我们需要配置 Kerberos,以便它可以与 AFS 一起工作。 ### 配置 /etc/krb5.conf 编辑 /etc/krb5.conf 文件,并做出以下更改: ``` [logging] default = FILE:/var/log/krb5libs.log kdc = FILE:/var/log/krb5kdc.log admin_server = FILE:/var/log/kadmind.log [libdefaults] default_realm = EXAMPLE.COM dns_lookup_realm = false dns_lookup_kdc = false ticket_lifetime = 24h renew_lifetime = 7d forwardable = true [realms] EXAMPLE.COM = { kdc = kerberos.example.com admin_server = kerberos.example.com } [domain_realm] .example.com = EXAMPLE.COM example.com = EXAMPLE.COM ``` 将 EXAMPLE.COM 替换为您的域名,将 kerberos.example.com 替换为您的 Kerberos 服务器的主机名或 IP 地址。 ### 创建 Kerberos 数据库 使用以下命令创建 Kerberos 数据库: ``` kdb5_util create -s ``` ### 启动 Kerberos 服务 使用以下命令启动 Kerberos 服务: ``` systemctl start krb5kdc systemctl start kadmin ``` ### 添加管理员账户 使用以下命令创建管理员账户: ``` kadmin.local -q "addprinc root/admin" ``` 您需要设置一个密码以保护管理员账户。 ## 配置 OpenAFS 现在,我们需要配置 OpenAFS,以允许我们在服务器上运行 AFS 服务。 ### 配置 /etc/openafs/ThisCell 编辑 /etc/openafs/ThisCell 文件,并将其设置为您的 AFS 单元名称。例如: ``` example.com ``` ### 配置 /etc/openafs/CellServDB 编辑 /etc/openafs/CellServDB 文件,并将其设置为您的 AFS 单元服务器的主机名或 IP 地址。例如: ``` >cat /etc/openafs/CellServDB # This file is automatically generated by OpenAFS. Do not edit. # # The format of this file is described in the OpenAFS Administration Guide. # >echo "192.168.1.100" >> /etc/openafs/CellServDB ``` ### 启动 OpenAFS 服务 使用以下命令启动 OpenAFS 服务: ``` systemctl start openafs-client systemctl start openafs-server ``` ### 设置 AFS 管理账户 使用以下命令设置 AFS 管理账户: ``` pts createuser admin system:anyuser -nomembership ``` ### 创建 AFS 卷 使用以下命令创建一个名为 testvol 的 AFS 卷: ``` fs mkmount /afs/testvol -rw /vicepa ``` ### 测试 AFS 使用以下命令测试 AFS 是否正常工作: ``` echo "This is a test file" > /afs/testvol/test.txt cat /afs/testvol/test.txt ``` 如果输出为 "This is a test file",则说明 AFS 已经成功地安装和配置。 ## 结论 在本文中,我们介绍了如何在 CentOS 7 上部署 AFS 平台。我们首先安装了基本依赖项,然后配置了 Kerberos 和 OpenAFS。最后,我们创建了一个 AFS 卷并进行了测试以确保 AFS 正常工作。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值