安装过程日志逆向理解[三]
# 3、Redis 安装与启动日志解读
提示
本节精选 Ambari 自动化安装 Redis 集群过程中的关键日志,结合实际执行流程,带你透过日志表象还原底层机制和排障逻辑 ,避免只看界面错过隐藏风险。
# 3.1 主节点安装日志详解
以 master 节点为例,关注关键资源、目录、配置及版本切换过程
- 软件包 Package['redis_3_2_0']
- 目录权限 Directory['/var/log/redis']、/var/lib/redis、/var/run/redis
- 配置渲染 File['/etc/redis/redis.conf'](模板渲染)
- 版本切换 bigtop-select 执行分发
# 核心日志示例
2024-09-10 03:05:31,084 - Group['hadoop'] {}
2024-09-10 03:05:48,070 - Creating directory Directory['/var/log/redis'] since it doesn't exist.
2024-09-10 03:05:48,099 - File['/etc/redis/redis.conf'] {'owner': 'redis', 'content': Template('redis.conf.j2'), 'group': 'hadoop', 'mode': 0644}
2024-09-10 03:05:48,830 - Execute[('ambari-python-wrap', ... 'redis-master', '3.2.0')] {'sudo': True}
2024-09-10 03:05:49,148 - Unable to create versioned configuration directories since the parameters supplied do not support it
2024-09-10 03:05:49,166 - Skipping the conf-select tool on ... since /etc/hive/conf does not exist.
Command completed successfully!
1
2
3
4
5
6
7
2
3
4
5
6
7
笔记
亮点解读:
- 权限与目录自动分配,杜绝环境不一致导致的安装失败
- 配置文件由 Jinja2 模板自动渲染,便于批量定制
- bigtop-select 自动完成 redis-master/redis-client 软链/切换,适配多版本并存需求
# 3.2 从节点安装日志详解
slave 安装过程与 master 类似,重点在于角色标识和最终的集群互认。
- slave模式 Package/Directory/File 步骤一致
- 版本切换 bigtop-select 对 redis-slave 生效
# 典型日志片段
2024-09-10 03:05:59,401 - Directory['/var/run/redis'] {'owner': 'redis', 'group': 'hadoop', 'create_parents': True, 'mode': 0755}
2024-09-10 03:05:59,420 - File['/etc/redis/redis.conf'] {'owner': 'redis', ...}
2024-09-10 03:05:59,808 - Execute[... 'redis-slave', '3.2.0')] {'sudo': True}
2024-09-10 03:05:59,959 - Skipping the conf-select tool on ... since /etc/tez/conf does not exist.
Command completed successfully!
1
2
3
4
5
2
3
4
5
注意
如发现目录或文件权限、属主异常,极易导致 Redis 进程无法启动或切换端口失败,此时优先排查安装日志。
# 3.3 主节点启动日志与服务拉起
2024-09-10 03:06:05,832 - Starting Redis Master on port 6379
2024-09-10 03:06:05,832 - Execute['/usr/bigtop/current/redis-master/src/redis-server /etc/redis/redis.conf --cluster-config-file /etc/redis/cluster_master.conf --pidfile /var/run/redis/redis_master.pid'] {'user': 'redis'}
1
2
2
笔记
- 明确日志标记启动命令,参数涵盖配置文件、集群配置、PID 路径等
- 进程守护与分布式运维工具深度联动,后续异常可自动恢复
# 3.4 从节点启动及集群互认日志
2024-09-10 03:06:08,938 - Starting Redis Slave on port 6380
2024-09-10 03:06:09,152 - Cluster is already initialized. Proceeding with slave addition.
2024-09-10 03:06:09,152 - Available Master nodes: ['centos1', 'centos3', 'centos2']
2024-09-10 03:06:09,152 - Assigning Slave on port 6379 to Master centos2
2024-09-10 03:06:09,245 - Redis Slave with IP 172.20.0.4 is already in the cluster ... skipping addition.
Command completed successfully!
1
2
3
4
5
6
2
3
4
5
6
提示
- slave 节点启动时会自动校验集群已初始化并完成主从映射
- 支持主从反亲和部署,自动跳过已加入节点
- 日志里“Cluster is already initialized.” 即为集群健康状态的关键标志
# 3.5 典型日志结构与排查表
阶段 | 日志关键点/现象 | 问题排查建议 |
---|---|---|
安装(主从) | Package、Directory、File、bigtop-select | 检查目录属主、权限、模板渲染 |
启动(master) | Starting Redis Master ... | 配置参数、PID 路径、进程守护 |
启动(slave) | Starting Redis Slave ... | 集群互认、主从分配、端口/同步状态 |
只要把日志看懂,80%的分布式安装问题都能高效定位和复盘!