当前位置: 首页 > wzjs >正文

自己做一个网站要多少钱自己做的网站页面错误

自己做一个网站要多少钱,自己做的网站页面错误,物流建设网站,做伞的外国网站以下是使用 Redis 源码 tar 包在三台机器上安装 Redis 哨兵模式(Sentinel)的详细步骤,采用原生安装方式(非 Docker): 环境准备 三台 CentOS/Ubuntu 服务器(假设 IP 如下)&#xff1…

以下是使用 Redis 源码 tar 包在三台机器上安装 Redis 哨兵模式(Sentinel)的详细步骤,采用原生安装方式(非 Docker):


环境准备

  • 三台 CentOS/Ubuntu 服务器(假设 IP 如下):
    • node1: 192.168.1.10 (主节点)
    • node2: 192.168.1.11 (从节点)
    • node3: 192.168.1.12 (从节点)
  • Redis 版本:7.0.12(以最新稳定版为例)
  • 端口规划
    • Redis: 6379
    • Sentinel: 26379

1. 在所有节点安装 Redis

(1)安装依赖
# CentOS
yum install -y gcc make tcl# Ubuntu
apt-get update && apt-get install -y build-essential tcl
(2)下载并编译 Redis
wget https://download.redis.io/releases/redis-7.0.12.tar.gz
tar xzf redis-7.0.12.tar.gz
cd redis-7.0.12
make && make install
(3)创建配置文件目录
mkdir -p /etc/redis /var/lib/redis /var/log/redis

2. 配置主节点(node1)

(1)编辑 Redis 配置文件
vim /etc/redis/redis.conf

关键配置

bind 0.0.0.0
port 6379
daemonize yes
pidfile /var/run/redis_6379.pid
dir /var/lib/redis
appendonly yes
requirepass yourpassword  # 设置密码(可选)
masterauth yourpassword   # 如果设置了密码,从节点需要此项
(2)启动 Redis
redis-server /etc/redis/redis.conf

3. 配置从节点(node2 和 node3)

(1)编辑 Redis 配置文件
vim /etc/redis/redis.conf

额外添加

replicaof 192.168.1.10 6379  # 指向主节点
masterauth yourpassword      # 如果主节点有密码
(2)启动 Redis
redis-server /etc/redis/redis.conf

4. 配置 Sentinel(所有节点)

(1)编辑 Sentinel 配置文件
vim /etc/redis/sentinel.conf

内容如下

port 26379
daemonize yes
sentinel monitor mymaster 192.168.1.10 6379 2
sentinel down-after-milliseconds mymaster 5000
sentinel failover-timeout mymaster 10000
sentinel auth-pass mymaster yourpassword  # 如果主节点有密码
(2)启动 Sentinel
redis-sentinel /etc/redis/sentinel.conf

5. 验证集群

(1)检查主从复制
# 在主节点执行
redis-cli info replication

输出应显示:

role:master
connected_slaves:2
slave0:ip=192.168.1.11,port=6379,state=online
slave1:ip=192.168.1.12,port=6379,state=online
(2)测试 Sentinel 故障转移
# 手动关闭主节点 Redis
redis-cli -h 192.168.1.10 shutdown# 查看 Sentinel 选举结果
redis-cli -p 26379 sentinel get-master-addr-by-name mymaster

约 10 秒后应返回新的主节点 IP。


6. 设置开机自启(所有节点)

(1)创建 systemd 服务文件
vim /etc/systemd/system/redis.service

内容

[Unit]
Description=Redis
After=network.target[Service]
Type=forking
ExecStart=/usr/local/bin/redis-server /etc/redis/redis.conf
ExecStop=/usr/local/bin/redis-cli shutdown
Restart=always[Install]
WantedBy=multi-user.target
(2)启动服务
systemctl daemon-reload
systemctl enable redis
systemctl start redis

关键配置说明

参数作用
sentinel monitor mymaster...指定监控的主节点,2 表示需要 2 个 Sentinel 同意才触发故障转移
down-after-milliseconds 50005 秒无响应判定节点宕机
replicaof从节点需配置此项指向主节点
requirepass / masterauth如果启用密码认证,主从和 Sentinel 需一致

常见问题解决

  1. 主从无法同步

    • 检查防火墙是否开放 6379 端口:firewall-cmd --add-port=6379/tcp --permanent
    • 确保主节点 redis.confbind 0.0.0.0
  2. Sentinel 不触发故障转移

    • 确认至少有两个 Sentinel 能联通主节点
    • 检查 sentinel.conf 中的主节点 IP 和密码是否正确
  3. 从节点无法提升为主节点

    • 确保 redis.conf 中未设置 replica-read-only no(从节点默认只读)

扩展建议

  • 监控:使用 redis-cli info 或 Prometheus + Redis Exporter
  • 高可用:可增加更多 Sentinel 节点(建议至少 3 个)
  • 安全:通过防火墙限制 Redis 和 Sentinel 端口的访问来源

此方案适合生产环境,如需更自动化部署,可结合 Ansible 或 Shell 脚本批量操作。


文章转载自:

http://xZNoVs9I.LfgqL.cn
http://zk81YGce.LfgqL.cn
http://7Wua85NR.LfgqL.cn
http://IXqIatSq.LfgqL.cn
http://YB6gfAP4.LfgqL.cn
http://oMv7YCWN.LfgqL.cn
http://BV1F6INH.LfgqL.cn
http://VYYkT0FW.LfgqL.cn
http://LSh5USug.LfgqL.cn
http://nr3bw45L.LfgqL.cn
http://rji3LebC.LfgqL.cn
http://qHy0GmaR.LfgqL.cn
http://Eq4qEJJJ.LfgqL.cn
http://YZhh6tCF.LfgqL.cn
http://BVlViZ6h.LfgqL.cn
http://N2ac9SSU.LfgqL.cn
http://qr27pyP8.LfgqL.cn
http://Sal6LsGt.LfgqL.cn
http://T5iGnAaZ.LfgqL.cn
http://h3fMtYc8.LfgqL.cn
http://E57NOL9S.LfgqL.cn
http://F0M9ns45.LfgqL.cn
http://Wp5xD7mW.LfgqL.cn
http://H2TPTGrV.LfgqL.cn
http://3LXCLN8H.LfgqL.cn
http://UBXNsCxP.LfgqL.cn
http://9Om3VNS3.LfgqL.cn
http://MBUnG8P1.LfgqL.cn
http://JpaSu6XG.LfgqL.cn
http://tIyLnDTB.LfgqL.cn
http://www.dtcms.com/wzjs/675384.html

相关文章:

  • 营销型网站怎么做教务管理系统登录入口
  • 著名的网站建设平台采购平台网
  • 什么是网站交互宁波网站优化
  • 网站建设费用的财务核算合肥经开区建设局网站
  • 杭州建设局网站电子商务网站建设背景
  • golang做网站人力资源招聘公司
  • 网站建设免备案免费空间皮具制品 东莞网站建设
  • 经营类网站备案黄石市新闻
  • 国外网站托管个人教程网站
  • php网站建设含义网站域名做固定资产怎么处理
  • 自己创业做网站口碑营销案例2021
  • 上海制作网站的公司有哪些手机网站宽度是多少
  • 基于jsp的电子商务网站开发做网站网站建设专业公司哪家好
  • 创新的盐城网站开发株洲 网站建设 公司
  • 网站运营服务中心建设方案中国服务外包公司排名
  • 宜飞思工业设计网站58同城湛江网站建设
  • 手机交互设计网站做游戏网站有钱赚吗
  • 接广告的网站为什么网址在浏览器里打不开
  • 网站怎样和首页做链接地址页面访问升级正常更新中
  • 平顶山网站建设电话卸载西部数码网站管理助手
  • 甘肃电子商务网站建设网站返回503的含义是
  • 爱站长专门找事做的网站
  • 网站流量查询1核1g WordPress 华为云
  • 网站开发+进度表南通企业自助建站系统
  • 西安网站建设小程序网站建设办公软件销售技巧
  • 荆门网站建设wordpress超级密码
  • 网站项目设计书上饶便宜的做网站公司
  • g4560做网站服务器wordpress 调用logo
  • 萍乡做网站的公司个人可以做建站网站么
  • 成都公司网站seo网站开发交接协议书