FastDFS蛋疼的集群和负载均衡(二)之tracker和stroage集群配置

diary_report.jpg

Interesting things

接着上一篇来写。

What did you do today

With RHEL 7 / CentOS 7, firewalld was introduced to manage iptables. IMHO, firewalld is more suited for workstations than for server environments.
It is possible to go back to a more classic iptables setup. First, stop and mask the firewalld service
* 上一篇我们发现在/etc/sysconfig/下没有看到iptables,并且我们使用iptbales -P INPUT ACCESPT
service iptables save命令写入防火墙策略的时候,抛出了”The service command supports only basic LSB actions (start, stop, restart, try-restart, reload, force-reload, status). For other actions, please try to use systemctl.”异常,而且用service iptables status查看防火墙的状态也提示”Unit iptables.service could not found”

image.png

  • 查阅资料发现,CentOS 7引入(默认firewalld)了firewalld来管理iptables,如果我们想回到iptables设置,首先我们需要停止firewalld,命令: systemctl stop firewalld, 然后屏蔽firewalld, systemctl mask firewalld,它是创建一个/etc/systemd/system/firewalld.service到 /dev/null的符号链接去屏蔽firewalld的服务。

image.png
* 安装iptables-services, yum install iptables-services
image.png

  • 启用iptables, systemctl enable iptables.
    image.png

  • 启动iptables, systemctl start iptables,然后我们进入/etc/sysconfig/,发现iptables文件出现了
    image.png

  • 我们进入/etc/sysconfig/iptables,添加访问22122端口的策略,直接复制上面就行了,改个端口号就ok了。
    -A INPUT -p tcp -m state –state NEW -m tcp –dport 22122 -j ACCEPT

image.png

  • 让防火墙策略生效。service iptables save.
    image.png

  • 重启防火墙,二种方式都可以。systemctl restart iptables
    service iptables restart

image.png

  • 通过/etc/init.d/fdfs_trackerd start来启动,然后用ps -ef|grep fdfs来查看tracker是否正常启动。

image.png
image.png

  • 还记得我们之前配置tracker.conf的时候把里面的base_path改成了/fastdfs/tracker,我们进入/fastdfs/tracker里面发现多了data,logs两个文件夹
    image.png

  • 我们打开logs文件夹会发现trackerd.log

    [2017-12-27 10:38:41] INFO - FastDFS v5.05, base_path=/fastdfs/tracker, run_by_group=, run_by_user=, connect_timeout=30s, network_timeout=60s, port=22122, bind_addr=, max_connections=256, accept_threads=1, work_threads=4, store_lookup=0, store_group=, store_server=0, store_path=0, reserved_storage_space=10.00%, download_server=0, allow_ip_count=-1, sync_log_buff_interval=10s, check_active_interval=120s, thread_stack_size=64 KB, storage_ip_changed_auto_adjust=1, storage_sync_file_max_delay=86400s, storage_sync_file_max_time=300s, use_trunk_file=0, slot_min_size=256, slot_max_size=16 MB, trunk_file_size=64 MB, trunk_create_file_advance=0, trunk_create_file_time_base=02:00, trunk_create_file_interval=86400, trunk_create_file_space_threshold=20 GB, trunk_init_check_occupying=0, trunk_init_reload_from_binlog=0, trunk_compress_binlog_min_interval=0, use_storage_id=0, id_type_in_filename=ip, storage_id_count=0, rotate_error_log=0, error_log_rotate_time=00:00, rotate_error_log_size=0, log_file_keep_days=0, store_slave_file_use_link=0, use_connection_pool=0, g_connection_pool_max_idle_time=3600s

  • 打开data文件夹,会发现fdfs_trackerd.pid(里面是3185,进程标识符)和storage_changelog.dat(里面为空)。

  • 接下来我们需要配置storage,将group1(192.168.12.33, 192.168.12.44)和group2(192.18.12.55, 192.168.12.66)作为我们的存储节点。

  • 拷贝storage.conf.sample,并且重命名为storage.conf。
    image.png

    • 给192.168.12.44、192.168.12.55、192.168.12.66都拷贝一份storage.conf
      image.png

    • 更改group1的storage.conf,把base_path改成/fastdfs/storage
      image.png

  • 我们可以storage server的端口号是23000,group_name修改成自己所在的组,192.168.12.33和192.168.12.44对应的group_name=group1, 192.168.12.55和192.168.12.66对应的group_name=group2。
    image.png

  • 默认storage存储路径的个数是1,
    我们把storage_path0修改成/fastdfs/storage
    image.png

  • 配置tracker_server=192.168.12.11:22122、tracker_server=192.168.12.22:2212
    所配置的地址也就是tracker1和tracker2地址。
    image.png

  • 我们可以到storage的web端口是8888。
    image.png

  • 然后把配置完的stroage.conf拷贝给192.168.12.44、192.168.12.55、192.168.12.66。192.168.12.44不用做任何修改,192.168.12.55和192.168.12.66只用把group_name修改为group2即可。

  • 创建/fastdfs/storage。mkdir -p /fastdfs/storage

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值