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

shell 脚本之一键部署安装 Nginx

定义一个变量来存放 nginx 版本号

version=1.15.4

nginx 下载地址:http://nginx.org/download/

下列函数功能则是判断当前步骤是否执行成功,并将结果输出出来

function show_result(){if [ "$1" -eq 0 ]thenecho -e "\e[32m$2 is Success .   [ OK ] \e[0m"elseecho -e "\e[31m$2 is Fail .   [ FAIL ] \e[0m"fi
}

创建 nginx 用户和用户组(建议用大于 1000 的 GID 和 UID 号,表示普通用户)
这段代码里我做了一个条件判断:

如果在 /etc/passwd 和 /etc/group 文件中过滤出 nginx,表示已经创建了 nginx 用户和 nginx 用户组,就不再创建了
 

安装一些扩展包

function nginx_pkg(){local item="Packages Install"yum -y install gcc openssl-devel pcre-devel zlib-devel > /dev/null 2>&1 show_result $? "${item}"
}

 

下载Nginx并解压缩

function nginx_download(){local item="Nginx Download"cd /usr/local/src && \wget http://nginx.org/download/nginx-${version}.tar.gz > /dev/null 2>&1 test -e /usr/local/src/nginx-${version} || tar zxf nginx-${version}.tar.gz rm -rf /usr/local/src/nginx-${version}.tar.gzshow_result $? "${item}"
}

 

编译安装 Nginx

这里也做了一个条件判断:

如果 /usr/local/nginx 目录存在,则说明 nginx 已经成功安装好了

function nginx_compile(){local item="Nginx Compile"cd /usr/local/src/nginx-${version}if [ `ls -l  /usr/local/ | grep 'nginx' | wc -l` -ge 1  ];thenecho -e "\e[31mNginx exist! \e[0m"else./configure --prefix=/usr/local/nginx > /dev/null 2>&1 && make > /dev/null 2>&1 && make install > /dev/null 2>&1 fishow_result $? "${item}"
}

 

建立软连接

function nginx_softlink(){local item="Nginx Softlink"test -d /etc/nginx/ || ln -s /usr/local/nginx/conf/ /etc/nginxtest -e /usr/sbin/nginx || ln -s /usr/local/nginx/sbin/nginx /usr/sbin/show_result $? "${item}"
}

 注册服务

将 nginx 注册成服务之后就可以使用 systemctl 控制它了

function nginx_service(){local item="Nginx Service"test -e /usr/lib/systemd/system/nginx.service || \ echo '
[Unit]
Description=The nginx HTTP and reverse proxy server
After=network-online.target remote-fs.target nss-lookup.target
Wants=network-online.target
[Service]
Type=forking
PIDFile=/usr/local/nginx/logs/nginx.pid
# Nginx will fail to start if /run/nginx.pid already exists but has the wrong
# SELinux context. This might happen when running `nginx -t` from the cmdline.
# https://bugzilla.redhat.com/show_bug.cgi?id=1268621ExecStartPre=/usr/bin/rm-f /usr/local/nginx/logs/nginx.pid
ExecStartPre=/usr/local/nginx/sbin/nginx -t
ExecStart=/usr/local/nginx/sbin/nginx
ExecReload=/usr/local/nginx/sbin/nginx -s reload
KillSignal=SIGQUIT
TimeoutStopSec=5
KillMode=process
PrivateTmp=true' > /usr/lib/systemd/system/nginx.servicesystemctl daemon-reload show_result $? "${item}"
}

内核参数优化

function nginx_kernel(){local item="Optimize Kernel Arguments"cp /etc/sysctl.conf /etc/sysctl.conf.${current_time} > /dev/null 2>&1arch_ratio=$([[ ! -z $(uname -a | grep x86_64) ]] && expr 64 / 32 || expr 32 / 32)memory_size=$(free -b| awk 'NR==2{print $2}')nf_conntrack_size=$(expr ${memory_size} / 16384 / ${arch_ratio})#开启反向路径过滤add_config_tofile "net.ipv4.conf.default.rp_filter = 1" /etc/sysctl.confadd_config_tofile "net.ipv4.conf.all.rp_filter = 1" /etc/sysctl.conf#处理无源路由包add_config_tofile "net.ipv4.conf.all.accept_source_route = 0" /etc/sysctl.confadd_config_tofile "net.ipv4.conf.default.accept_source_route = 0" /etc/sysctl.conf#core文件名中添加pid作为扩展名add_config_tofile "kernel.core_uses_pid = 1" /etc/sysctl.conf#开启syn洪水攻击保护add_config_tofile "net.ipv4.tcp_syncookies = 1" /etc/sysctl.conf#修改消息队列长度add_config_tofile "kernel.msgmnb = 65536" /etc/sysctl.confadd_config_tofile "kernel.msgmax = 65536" /etc/sysctl.conf#修改最大内存共享段大小bytesadd_config_tofile "kernel.shmmax = 68719476736" /etc/sysctl.confadd_config_tofile "kernel.shmall = 4294967296" /etc/sysctl.conf#timewait数量默认18000add_config_tofile "net.ipv4.tcp_max_tw_buckets = 600" /etc/sysctl.confadd_config_tofile "net.ipv4.tcp_sack = 1" /etc/sysctl.confadd_config_tofile "net.ipv4.tcp_window_scaling = 1" /etc/sysctl.confadd_config_tofile "net.ipv4.tcp_rmem = 4096 87380 16777216" /etc/sysctl.confadd_config_tofile "net.ipv4.tcp_wmem = 4096 65536 16777216" /etc/sysctl.confadd_config_tofile "net.core.rmem_default = 8388608" /etc/sysctl.confadd_config_tofile "net.core.wmem_max = 16777216" /etc/sysctl.conf#未收到客户端确认信息连接请求的最大值add_config_tofile "net.ipv4.tcp_max_syn_backlog = 262144" /etc/sysctl.conf#放弃建立连接之前发送的synack包add_config_tofile "net.ipv4.tcp_syn_retries = 2" /etc/sysctl.conf#开启重用,允许time—wait socket 重新用语新的tcp连接add_config_tofile "net.ipv4.tcp_tw_reuse = 1" /etc/sysctl.confadd_config_tofile "net.ipv4.tcp_fin_timeout = 1" /etc/sysctl.conf#防止简单的ddos攻击add_config_tofile "net.ipv4.tcp_max_orphans = 3276800" /etc/sysctl.conf#启用timewait快速收回add_config_tofile "net.ipv4.tcp_tw_recycle = 0" /etc/sysctl.conf#keeptime启用时tcp发送keepalive消息的频度,默认2hadd_config_tofile "net.ipv4.tcp_keepalive_time = 600" /etc/sysctl.conf#允许系统打开的端口范围add_config_tofile "net.ipv4.ip_local_port_range = 1024 65535" /etc/sysctl.conf#资源回收add_config_tofile "net.ipv4.tcp_tw_recycle = 0" /etc/sysctl.conf#路由转发add_config_tofile "net.ipv4.ip_forward = 1" /etc/sysctl.conf #修改防火墙连接跟踪表大小,默认65535add_config_tofile "net.netfilter.nf_conntrack_max = ${nf_conntrack_size}" /etc/sysctl.confadd_config_tofile "net.nf_conntrack_max = ${nf_conntrack_size}" /etc/sysctl.conf#解禁pingadd_config_tofile "net.ipv4.icmp_echo_ignore_all = 0" /etc/sysctl.confmodprobe bridgesysctl -p > /dev/null 2>&1show_result $? "${item}"
}

启动nginx并开机自启

function nginx_start(){local item="Nginx start"systemctl enable nginx --now > /dev/null 2>&1show_result $? "${item}"
}

负责配置的写入函数

在上面的内核参数优化函数里面,我并没有使用 echo 将配置直接重定向到 /etc/sysctl.conf 文件里面

而是用了 add_config_tofile 函数,第一个参数是配置项,第二个参数是文件名

function add_config_tofile(){local keywords=`echo $1| awk -F "[= ]+" '{print $1}'`local SearchResult=`grep "^${keywords}" "$2"`if [ -z "${SearchResult}" ]thenecho $1 >> $2elsesed -i "s/^${keywords}.*/$1/" $2fi
}

main函数

function main(){user_createnginx_pkgnginx_downloadnginx_compilenginx_softlinknginx_servicenginx_kernelnginx_start
}

 

 完整代码

执行结果如下:

#! /bin/bashversion=1.15.4#判断函数是否执行成功
function show_result(){if [ "$1" -eq 0 ]thenecho -e "\e[32m$2 is Success .   [ OK ] \e[0m"elseecho -e "\e[31m$2 is Fail .   [ FAIL ] \e[0m"fi
}#创建 nginx 用户和用户组
function user_create(){local item="Create User and Group"if [ `cat /etc/{passwd,group} | grep nginx | wc -l ` -ge 2  ];thenecho -e "\e[31mUser and Group exist! \e[0m"elsegroupadd -g 1004 nginx && \useradd -u 1004 -g 1004 -M  -s /sbin/nologin nginx    show_result $? "${item}"fi
}#下载一些拓展包
function nginx_pkg(){local item="Packages Install"yum -y install gcc openssl-devel pcre-devel zlib-devel > /dev/null 2>&1 show_result $? "${item}"
}#下载nginx
function nginx_download(){local item="Nginx Download"cd /usr/local/src && \wget http://nginx.org/download/nginx-${version}.tar.gz > /dev/null 2>&1 test -e /usr/local/src/nginx-${version} || tar zxf nginx-${version}.tar.gz rm -rf /usr/local/src/nginx-${version}.tar.gzshow_result $? "${item}"
}#编译安装
function nginx_compile(){local item="Nginx Compile"cd /usr/local/src/nginx-${version}if [ `ls -l  /usr/local/ | grep 'nginx' | wc -l` -ge 1  ];thenecho -e "\e[31mNginx exist! \e[0m"else./configure --prefix=/usr/local/nginx > /dev/null 2>&1 && make > /dev/null 2>&1 && make install > /dev/null 2>&1 fishow_result $? "${item}"
}#软连接建立
function nginx_softlink(){local item="Nginx Softlink"test -d /etc/nginx/ || ln -s /usr/local/nginx/conf/ /etc/nginxtest -e /usr/sbin/nginx || ln -s /usr/local/nginx/sbin/nginx /usr/sbin/show_result $? "${item}"
}#注册服务
function nginx_service(){local item="Nginx Service"test -e /usr/lib/systemd/system/nginx.service || \ echo '
[Unit]
Description=The nginx HTTP and reverse proxy server
After=network-online.target remote-fs.target nss-lookup.target
Wants=network-online.target
[Service]
Type=forking
PIDFile=/usr/local/nginx/logs/nginx.pid
# Nginx will fail to start if /run/nginx.pid already exists but has the wrong
# SELinux context. This might happen when running `nginx -t` from the cmdline.
# https://bugzilla.redhat.com/show_bug.cgi?id=1268621ExecStartPre=/usr/bin/rm-f /usr/local/nginx/logs/nginx.pid
ExecStartPre=/usr/local/nginx/sbin/nginx -t
ExecStart=/usr/local/nginx/sbin/nginx
ExecReload=/usr/local/nginx/sbin/nginx -s reload
KillSignal=SIGQUIT
TimeoutStopSec=5
KillMode=process
PrivateTmp=true' > /usr/lib/systemd/system/nginx.servicesystemctl daemon-reload show_result $? "${item}"
}#内核优化
function nginx_kernel(){local item="Optimize Kernel Arguments"cp /etc/sysctl.conf /etc/sysctl.conf.${current_time} > /dev/null 2>&1arch_ratio=$([[ ! -z $(uname -a | grep x86_64) ]] && expr 64 / 32 || expr 32 / 32)memory_size=$(free -b| awk 'NR==2{print $2}')nf_conntrack_size=$(expr ${memory_size} / 16384 / ${arch_ratio})#开启反向路径过滤add_config_tofile "net.ipv4.conf.default.rp_filter = 1" /etc/sysctl.confadd_config_tofile "net.ipv4.conf.all.rp_filter = 1" /etc/sysctl.conf#处理无源路由包add_config_tofile "net.ipv4.conf.all.accept_source_route = 0" /etc/sysctl.confadd_config_tofile "net.ipv4.conf.default.accept_source_route = 0" /etc/sysctl.conf#core文件名中添加pid作为扩展名add_config_tofile "kernel.core_uses_pid = 1" /etc/sysctl.conf#开启syn洪水攻击保护add_config_tofile "net.ipv4.tcp_syncookies = 1" /etc/sysctl.conf#修改消息队列长度add_config_tofile "kernel.msgmnb = 65536" /etc/sysctl.confadd_config_tofile "kernel.msgmax = 65536" /etc/sysctl.conf#修改最大内存共享段大小bytesadd_config_tofile "kernel.shmmax = 68719476736" /etc/sysctl.confadd_config_tofile "kernel.shmall = 4294967296" /etc/sysctl.conf#timewait数量默认18000add_config_tofile "net.ipv4.tcp_max_tw_buckets = 600" /etc/sysctl.confadd_config_tofile "net.ipv4.tcp_sack = 1" /etc/sysctl.confadd_config_tofile "net.ipv4.tcp_window_scaling = 1" /etc/sysctl.confadd_config_tofile "net.ipv4.tcp_rmem = 4096 87380 16777216" /etc/sysctl.confadd_config_tofile "net.ipv4.tcp_wmem = 4096 65536 16777216" /etc/sysctl.confadd_config_tofile "net.core.rmem_default = 8388608" /etc/sysctl.confadd_config_tofile "net.core.wmem_max = 16777216" /etc/sysctl.conf#未收到客户端确认信息连接请求的最大值add_config_tofile "net.ipv4.tcp_max_syn_backlog = 262144" /etc/sysctl.conf#放弃建立连接之前发送的synack包add_config_tofile "net.ipv4.tcp_syn_retries = 2" /etc/sysctl.conf#开启重用,允许time—wait socket 重新用语新的tcp连接add_config_tofile "net.ipv4.tcp_tw_reuse = 1" /etc/sysctl.confadd_config_tofile "net.ipv4.tcp_fin_timeout = 1" /etc/sysctl.conf#防止简单的ddos攻击add_config_tofile "net.ipv4.tcp_max_orphans = 3276800" /etc/sysctl.conf#启用timewait快速收回add_config_tofile "net.ipv4.tcp_tw_recycle = 0" /etc/sysctl.conf#keeptime启用时tcp发送keepalive消息的频度,默认2hadd_config_tofile "net.ipv4.tcp_keepalive_time = 600" /etc/sysctl.conf#允许系统打开的端口范围add_config_tofile "net.ipv4.ip_local_port_range = 1024 65535" /etc/sysctl.conf#资源回收add_config_tofile "net.ipv4.tcp_tw_recycle = 0" /etc/sysctl.conf#路由转发add_config_tofile "net.ipv4.ip_forward = 1" /etc/sysctl.conf #修改防火墙连接跟踪表大小,默认65535add_config_tofile "net.netfilter.nf_conntrack_max = ${nf_conntrack_size}" /etc/sysctl.confadd_config_tofile "net.nf_conntrack_max = ${nf_conntrack_size}" /etc/sysctl.conf#解禁pingadd_config_tofile "net.ipv4.icmp_echo_ignore_all = 0" /etc/sysctl.confmodprobe bridgesysctl -p > /dev/null 2>&1show_result $? "${item}"
}#启动 nginx
function nginx_start(){local item="Nginx start"systemctl enable nginx --now > /dev/null 2>&1show_result $? "${item}"
}#负责写入配置的函数
function add_config_tofile(){local keywords=`echo $1| awk -F "[= ]+" '{print $1}'`local SearchResult=`grep "^${keywords}" "$2"`if [ -z "${SearchResult}" ]thenecho $1 >> $2elsesed -i "s/^${keywords}.*/$1/" $2fi
}
#主函数
function main(){user_createnginx_pkgnginx_downloadnginx_compilenginx_softlinknginx_servicenginx_kernelnginx_start
}main

 

相关文章:

shell 脚本之一键部署安装 Nginx

定义一个变量来存放 nginx 版本号 version1.15.4nginx 下载地址:http://nginx.org/download/ 下列函数功能则是判断当前步骤是否执行成功,并将结果输出出来 function show_result(){if [ "$1" -eq 0 ]thenecho -e "\e[32m$2 is Succes…...

第01章_Java语言概述拓展练习(为什么要设置path?)

文章目录 第01章_Java语言概述拓展练习1、System.out.println()和System.out.print()有什么区别?2、一个".java"源文件中是否可以包括多个类?有什么限制?3、Something类的文件名叫OtherThing.java是否可以?4、为什么要设…...

手机直连卫星及NTN简介

一、手机直连卫星的发展现状 近日,华为推出了支持北斗卫星短报文的Mate 50旗舰机、P60系列,苹果也跟Globalstar(全球星)合作推出了支持卫星求救的iPhone14,最亮眼的还是华为的。这几款产品揭开了卫星通信探索消费领域…...

对git中tag, branch的重新理解

1. 问题背景 项目中之前一个tag(v1.0)打错了,想删除它,但我们从此tag v1.0中迁出新建分支Branch_v1.0,在此分支下修复了bug,想重新打一个tag v1.0,原来的tag v1.0可以删除掉吗? 错误的理解&am…...

python中none的替换方法:pandasnumpy

none的替换方法: 1.pandas # 将缺失的id值替换为None merged_df[id].fillna(None, inplaceTrue) #这行代码使用了Pandas库中的fillna方法,对DataFrame中的id列进行了填充操作。具体来说,它将该列中的缺失值用字符串None进行填充&#xff0c…...

您与此网站之间建立的连接不安全

连接不安全的主要原因之一是使用不安全的通信协议。在互联网传输中,如果使用的协议不加密,那么数据就容易受到窃听和篡改。另一个可能的原因是网站没有正确配置其安全证书,使得用户的连接没有得到适当的加密保护。 解决方法: 采用…...

__declspec (dllexport)定义了导出函数,但dll中没有此函数

这个一个比较低级的问题,为避免两次犯这样的低级错误,特此记录。 发生这个问题的原因是未包含头文件,例如: test.h //在头文件中声明了导出函数test() #ifdef __cplusplus extern "C" { #endif /*__cplusplus 1*/ext…...

CSS样式学习

html超文本传输标签&#xff0c;属性等权重 outline 标签轮廓 <input type"text"> <textarea cols"30" rows"10"></textarea> outline: none; 表示无轮廓 &#xff08;开发时用的比较多&#xff09; CSS 轮廓&#xff…...

传感数据分析中的小波滤波:理论与公式

传感数据分析中的小波滤波&#xff1a;理论与公式 引言 在传感数据分析领域&#xff0c;小波滤波作为一种强大的信号处理工具&#xff0c;广泛应用于噪声去除、信号压缩、特征提取以及频谱分析等方面。本文将深入介绍小波滤波的理论基础和相关数学公式&#xff0c;以更全面地…...

iOS 按钮添加点击震动

1. 方法说明&#xff1a; iOS10后系统提供了一套API来简单实现震动&#xff1a; init时传入一个style定义好的枚举就可以实现不同的震动 typedef NS_ENUM(NSInteger, UIImpactFeedbackStyle) {UIImpactFeedbackStyleLight,UIImpactFeedbackStyleMedium,UIImpactFeedbackStyle…...

李沐-《动手学深度学习》--02-目标检测

一 、目标检测算法 1. R-CNN a . 算法步骤 使用启发式搜索算法来选择锚框&#xff08;选出多个锚框大小可能不一&#xff0c;需要使用Rol pooling&#xff09;使用预训练好的模型&#xff08;去掉分类层&#xff09;对每个锚框进行特征抽取&#xff08;如VGG,AlexNet…)训练…...

【EAI 006】ChatGPT for Robotics:将 ChatGPT 应用于机器人任务的提示词工程研究

论文标题&#xff1a;ChatGPT for Robotics: Design Principles and Model Abilities 论文作者&#xff1a;Sai Vemprala, Rogerio Bonatti, Arthur Bucker, Ashish Kapoor 作者单位&#xff1a;Scaled Foundations, Microsoft Autonomous Systems and Robotics Research 论文原…...

.pings勒索病毒的威胁:如何应对.pings勒索病毒的突袭?

引言&#xff1a; 在网络安全领域&#xff0c;.pings勒索病毒一直是不断演变的威胁之一。其变种的不断出现使得对抗这一数字威胁变得更加复杂。本节将深入剖析.pings勒索病毒变种的出现&#xff0c;以更好地理解其威胁性质和对策。如果受感染的数据确实有恢复的价值与必要性&a…...

Rustdesk本地配置文件存在什么地方?

环境&#xff1a; rustdesk1.1.9 Win10 专业版 问题描述&#xff1a; Rustdesk本地配置文件存在什么地方&#xff1f; 解决方案&#xff1a; RustDesk 是一款功能齐全的远程桌面应用。 支持 Windows、macOS、Linux、iOS、Android、Web 等多个平台。 支持 VP8 / VP9 / AV1 …...

36-javascript输出方式,弹框:普通,confirm弹框,prompt弹框,控制台输出:普通,warm,error

1.页面打印 <body><p>你真是一个小机灵鬼</p><script>// 页面打印document.write("打印内容");</script> </body> 2.覆盖文档 <body><p>你真是一个小机灵鬼</p><script>// 覆盖文档window.onload f…...

自动执行 Active Directory 清理

Active Directory &#xff08;AD&#xff09; 可帮助 IT 管理员分层存储组织的资源&#xff0c;包括用户、组以及计算机和打印机等设备&#xff0c;这有助于管理员集中创建基于帐户和组的规则&#xff0c;并通过创建不合规的自动日志来强制执行和确保合规性。 不时清理AD是保…...

DICE模型的原理与推导、碳循环与气候变化、政策评估、不确定性分析与代码分析

目录 专题一&#xff1a;DICE模型的原理与推导 专题二&#xff1a;碳循环与气候变化 专题三&#xff1a;政策评估 专题四&#xff1a;不确定性分析与代码分析 更多应用 随着温室气体排放量的增大和温室效应的增强&#xff0c;全球气候变化问题受到日益的关注。我国政府庄严…...

【机器学习前置知识】狄利克雷分布

在阅读本文前&#xff0c;建议先食用以下几篇文章以能更好地理解狄利克雷分布&#xff1a; 二项分布 Beta分布 多项分布 共轭分布 狄利克雷分布 狄利克雷分布(Dirichlet distribution)是Beta分布的扩展&#xff0c;把Beta分布从二元扩展到多元形式就是狄利克雷分布&#…...

Spring Retry(方法重试、方法重新调用)

Spring Retry——方法重试、方法重新调用 简介&#xff1a;使用1. 配置2.使用 总结注意 简介&#xff1a; Spring Retry 是一个 Spring Boot 官方提供的支持重试机制的库。它提供了一种简单而灵活的方式来处理方法调用可能失败的情况&#xff0c;通过自动重试失败的操作&#…...

JavaScript音视频,使用JavaScript如何在浏览器录制电脑摄像头画面为MP4视频文件并下载视频文件到本地

前言 本章介绍使用JavaScript如何在浏览器录制电脑摄像头画面为MP4视频文件并下载视频文件到本地。 实现功能 1、使用navigator.mediaDevices.getUserMedia获取摄像头画面 2、将获取到的摄像头画面渲染到canvas画板上 3、将canvas转换为blob对象 4、通过document.createElem…...

Python:操作 Excel 折叠

💖亲爱的技术爱好者们,热烈欢迎来到 Kant2048 的博客!我是 Thomas Kant,很开心能在CSDN上与你们相遇~💖 本博客的精华专栏: 【自动化测试】 【测试经验】 【人工智能】 【Python】 Python 操作 Excel 系列 读取单元格数据按行写入设置行高和列宽自动调整行高和列宽水平…...

Neo4j 集群管理:原理、技术与最佳实践深度解析

Neo4j 的集群技术是其企业级高可用性、可扩展性和容错能力的核心。通过深入分析官方文档,本文将系统阐述其集群管理的核心原理、关键技术、实用技巧和行业最佳实践。 Neo4j 的 Causal Clustering 架构提供了一个强大而灵活的基石,用于构建高可用、可扩展且一致的图数据库服务…...

css的定位(position)详解:相对定位 绝对定位 固定定位

在 CSS 中&#xff0c;元素的定位通过 position 属性控制&#xff0c;共有 5 种定位模式&#xff1a;static&#xff08;静态定位&#xff09;、relative&#xff08;相对定位&#xff09;、absolute&#xff08;绝对定位&#xff09;、fixed&#xff08;固定定位&#xff09;和…...

CRMEB 框架中 PHP 上传扩展开发:涵盖本地上传及阿里云 OSS、腾讯云 COS、七牛云

目前已有本地上传、阿里云OSS上传、腾讯云COS上传、七牛云上传扩展 扩展入口文件 文件目录 crmeb\services\upload\Upload.php namespace crmeb\services\upload;use crmeb\basic\BaseManager; use think\facade\Config;/*** Class Upload* package crmeb\services\upload* …...

Redis数据倾斜问题解决

Redis 数据倾斜问题解析与解决方案 什么是 Redis 数据倾斜 Redis 数据倾斜指的是在 Redis 集群中&#xff0c;部分节点存储的数据量或访问量远高于其他节点&#xff0c;导致这些节点负载过高&#xff0c;影响整体性能。 数据倾斜的主要表现 部分节点内存使用率远高于其他节…...

大数据学习(132)-HIve数据分析

​​​​&#x1f34b;&#x1f34b;大数据学习&#x1f34b;&#x1f34b; &#x1f525;系列专栏&#xff1a; &#x1f451;哲学语录: 用力所能及&#xff0c;改变世界。 &#x1f496;如果觉得博主的文章还不错的话&#xff0c;请点赞&#x1f44d;收藏⭐️留言&#x1f4…...

iview框架主题色的应用

1.下载 less要使用3.0.0以下的版本 npm install less2.7.3 npm install less-loader4.0.52./src/config/theme.js文件 module.exports {yellow: {theme-color: #FDCE04},blue: {theme-color: #547CE7} }在sass中使用theme配置的颜色主题&#xff0c;无需引入&#xff0c;直接可…...

怎么让Comfyui导出的图像不包含工作流信息,

为了数据安全&#xff0c;让Comfyui导出的图像不包含工作流信息&#xff0c;导出的图像就不会拖到comfyui中加载出来工作流。 ComfyUI的目录下node.py 直接移除 pnginfo&#xff08;推荐&#xff09;​​ 在 save_images 方法中&#xff0c;​​删除或注释掉所有与 metadata …...

STM32---外部32.768K晶振(LSE)无法起振问题

晶振是否起振主要就检查两个1、晶振与MCU是否兼容&#xff1b;2、晶振的负载电容是否匹配 目录 一、判断晶振与MCU是否兼容 二、判断负载电容是否匹配 1. 晶振负载电容&#xff08;CL&#xff09;与匹配电容&#xff08;CL1、CL2&#xff09;的关系 2. 如何选择 CL1 和 CL…...

Linux部署私有文件管理系统MinIO

最近需要用到一个文件管理服务&#xff0c;但是又不想花钱&#xff0c;所以就想着自己搭建一个&#xff0c;刚好我们用的一个开源框架已经集成了MinIO&#xff0c;所以就选了这个 我这边对文件服务性能要求不是太高&#xff0c;单机版就可以 安装非常简单&#xff0c;几个命令就…...