【LAMP架构-1】

工创赛智能搬运小车实战:视觉定位、底盘控制与RTOS调度 智能搬运系统是嵌入式控制与机器视觉融合的典型工程实践,其核心在于视觉定位精度、运动控制稳定性与实时任务调度能力。在有限算力(如STM32H7)、低功耗约束和结构化场景下,传统CV方法(如FAST+RANSAC)比轻量级深度学习更具鲁棒性与实时性;而底盘控制需穿透PID表层,直击死区补偿、编码器硬件滤波与负载自适应等物理层细节;RTOS则不是炫技工具,而是保障多模块时序确定性的刚需——尤其在视觉-控制-执行强耦合链路中,任务优先级、事件组通信与栈安全直接影响系统存活。本文聚焦全国大学生工程训练竞赛(工创赛)真 阅读详情

Nginx

负载均衡

首先在 server1 上编辑 Nginx 主配置文件,在 upstream 块中定义后端服务器池,分别指定 server2、server3 和 server4(只有当所有的后端server全部失效才会被启用) 的 IP 地址。轮询(round-robin)是默认的调度算法,请求会依次分配给每一台后端服务器。

[root@server1 ~]# vim /usr/local/nginx/conf/nginx.conf

为了让域名 www.example.com 能够解析到 server1 的 IP,需要在 server1 本地配置 hosts 解析记录。这样在测试时可以直接通过域名访问负载均衡入口。

[root@server1 ~]# vim /etc/hosts

配置完成后,多次访问 www.example.com 会发现请求在 server2、server3  之间轮询调度。

接下来模拟服务器故障场景:手动停止 server2 上的 httpd 服务,验证 Nginx 的健康检查机制是否能自动将请求切换到其他正常节点。

[root@server2 ~]# systemctl stop httpd

同样停止 server3 上的 httpd 服务,此时三台后端服务器中只剩 server4 可用。如果配置正确,所有请求应该都会被转发到 server4。

[root@server3 ~]# systemctl stop httpd

在 server2 和 server3 都已下线的情况下,再次访问 www.example.com 进行验证。

此时访问

设置cookie

[root@server1 ~]# vim /usr/local/nginx/conf/nginx.conf

修改完后检查语法后reload

修改Windows中的hosts文件(需要管理员权限)

C:\Windows\System32\drivers\etc

不同浏览器访问 F12打开开发者选项

模块编译

nginx 1.30.x 版本自带sticky功能

[root@server4 ~]# wget https://nginx.org/download/nginx-1.28.3.tar.gz //下载老版本

[root@server4 ~]# tar zxf nginx-1.28.3.tar.gz

[root@server4 ~]# git clone https://github.com/fabianofurtado/nginx_sticky_module_ng.git

[root@server4 ~]# cd nginx-1.28.3/

静态编译,模块与nginx主程序编译到一起,极致性能

[root@server4 nginx-1.28.3]# ./configure --prefix=/opt/nginx --with-http_ssl_module --with-http_stub_status_module --add-module=../nginx_sticky_module_ng

[root@server4 nginx-1.28.3]# make && make install

动态编译,nginx主程序与模块分开编译,适合经常需要扩展模块的场景

[root@server4 nginx-1.28.3]# make clean

[root@server4 nginx-1.28.3]# vim auto/cc/gcc

关闭debug模式

[root@server4 nginx-1.28.3]# ./configure --prefix=/opt/nginx --with-http_ssl_module --with-http_stub_status_module --with-compat --add-dynamic-module=../nginx_sticky_module_ng

[root@server4 nginx-1.28.3]# make

[root@server4 nginx-1.28.3]# cd objs

[root@server4 objs]# cp -f nginx /opt/nginx/sbin/nginx

[root@server4 objs]# mkdir /opt/nginx/modules

[root@server4 objs]# cp ngx_http_sticky_module.so /opt/nginx/modules/

在主配置文件中加载模块

[root@server4 ~]# vim /opt/nginx/conf/nginx.conf

load_module modules/ngx_http_sticky_module.so;

安全控制

限制并发连接数

[root@server1 ~]# vim /usr/local/nginx/conf/nginx.conf

[root@server1 ~]# nginx -t

[root@server1 ~]# nginx -s reload

[root@server1 ~]# mkdir /usr/local/nginx/html/download

[root@server1 ~]# cd /usr/local/nginx/html/download //在这里面上传一张图

必须单线程下载,超出的并发连接会失败

[root@server4 ~]# ab -c 10 -n 10 http://192.168.247.129/download/vim.jpg

[root@server1 ~]# tail -f /usr/local/nginx/logs/access.log

[root@server4 ~]# ab -c 1 -n 10 http://192.168.247.129/download/vim.jpg
[root@server1 nginx]# tail -f /usr/local/nginx/logs/access.log

限制请求数

[root@server1 ~]# vim /usr/local/nginx/conf/nginx.conf

[root@server1 ~]# nginx -t

[root@server1 ~]# nginx -s reload

测试

超出的请求数会失败

[root@server4 ~]# ab -c 1 -n 10 http://192.168.247.129/download/vim.jpg

限制速率

[root@server1 ~]# nginx -s reload

测试

[root@server4 ~]# ab -c 1 -n 5 http://192.168.247.129/download/vim.jpg

自动索引

[root@server1 ~]# vim /usr/local/nginx/conf/nginx.conf

[root@server1 ~]# nginx -t

[root@server1 ~]# nginx -s reload

缓存配置

[root@server1 ~]# vim /usr/local/nginx/conf/nginx.conf

location ~ .*\.(gif|jpg|png)$ {

expires 365d;

root html;

}

[root@server1 ~]# nginx -t

[root@server1 ~]# nginx -s reload

日志轮转

[root@server1 ~]# mkdir /opt/scripts

[root@server1 ~]# vim /opt/scripts/nginxlog.sh

#!/bin/bash

cd /usr/local/nginx/logs && mv access.log access_$(date +%F -d -1day).log

kill -USR1 `cat /usr/local/nginx/logs/nginx.pid`

[root@server1 ~]# chmod +x /opt/scripts/nginxlog.sh

[root@server1 ~]# /opt/scripts/nginxlog.sh

[root@server1 logs]# ll /usr/local/nginx/logs

nginx日志可视化

下载软件包

[root@server1 ~]# wget https://tar.goaccess.io/goaccess-1.8.tar.gz

[root@server1 ~]# tar xf goaccess-1.8.tar.gz

[root@server1 ~]# cd goaccess-1.8/

[root@server1 goaccess-1.8]# yum install -y ncurses-devel GeoIP-devel

[root@server1 goaccess-1.8]# yum install -y epel-release

[root@server1 goaccess-1.8]# yum install -y libmaxminddb-devel glib2-devel ncurses-devel zlib-devel

root@server1 goaccess-1.8]# ./configure --enable-utf8 --enable-geoip=mmdb

[root@server1 goaccess-1.8]# make && make install

启动

[root@server1 ~]# goaccess /usr/local/nginx/logs/access.log -o /usr/local/nginx/html/report.html --log-format=COMBINED --real-time-html &

访问:http://192.168.247.129/report.html

站点限制

location /status {

stub_status on; #启用监控模块

access_log off; #禁用日志记录

allow 127.0.0.1; #只允许本机访问

deny all; #禁用所有主机访问

}

[root@server1 ~]# nginx -s reload

中文乱码

[root@server1 ~]# vim /usr/local/nginx/html/index.html

[root@server1 ~]# vim /usr/local/nginx/conf/nginx.conf

[root@server1 ~]# nginx -s reload

虚拟主机

[root@server1 ~]# nginx -t

[root@server1 ~]# nginx -s reload

[root@server1 ~]# mkdir /web1
[root@server1 ~]# echo www.example.com > /web1/index.html

测试

[root@server4 ~]# vim /etc/hosts

https配置

[root@server1 ~]# cd /etc/pki/tls/certs
[root@server1 certs]# make cert.pem

[root@server1 certs]# mv cert.pem /usr/local/nginx/conf/

[root@server1 certs]# vim /usr/local/nginx/conf/nginx.conf

[root@server1 ~]# nginx -t

[root@server1 ~]# nginx -s reload
[root@server4 ~]# curl -k https://www.example.com

curl -k 作用:跳过 HTTPS 证书合法性校验

重定向

80重定向到443

[root@server1 ~]# vim /usr/local/nginx/conf/nginx.conf

rewrite ^/(.*)$ https://www.example/$1 permanent;

[root@server1 ~]# nginx -t

[root@server1 ~]# nginx -s reload

www.example.com/bbs 重定向bbs.example.com

[root@server1 ~]# mkdir /bbs

[root@server1 ~]# echo bbs.example.com > /bbs/index.html
[root@server1 ~]# vim /usr/local/nginx/conf/nginx.conf

rewrite ^/bbs$ http://bbs.example.com permanent;
rewrite ^/bbs/(.*)$ http://bbs.example.com/$1 permanent;

[root@server1 ~]# nginx -s reload

防盗链

配置server2上的apache服务,盗链server1上的图片

[root@server2 ~]# cd /var/www/html/

[root@server2 html]# vim index.html

<html>
<body>
<img src="http://www.example.com/vim.jpg"/>
</body>
</html>

确保 /web1目录下有vim.jpg图片

[root@server2 html]# vim /etc/hosts //配置解析

Windows电脑同理配置解析

浏览器访问server2的ip地址

接下来在server1上配置防盗链

[root@server1 ~]# vim /usr/local/nginx/conf/nginx.conf

location ~ \.(jpg|png)$ {
root /web1;
valid_referers none blocked www.example.com;
if ($invalid_referer) {
#return 403;
rewrite ^/ http://bbs.example.com/daolian.jpg;
}
}

[root@server1 ~]# nginx -s reload

修改Windows电脑上的配置解析和确保 server1上的/bbs目录下有daolian.jpg

输入server2的ip访问

输入域名可以正常访问

php部署

php安装

[root@server1 ~]# tar xf php-8.3.32.tar.gz
[root@server1 ~]# cd php-8.3.32/

将源码包解压后进入其根目录,这里会看到 configure 脚本、ext/ 扩展目录以及 sapi/ 等核心子目录。后续所有操作——包括依赖安装、配置检测、编译和安装——都围绕这个目录展开。configure 是源码编译的核心环节,它会自动探测当前系统的库文件、头文件位置和编译器能力,生成适用于本机的 Makefile。如果系统中缺少必要的开发包(通常以 -devel 结尾),configure 阶段就会直接报错并给出缺失提示,因此提前把依赖装全可以大幅减少后续排查时间。

[root@server1 ~]# yum install -y bzip2 systemd-devel libxml2-devel sqlite-devel libpng-devel libcurl-devel

如果后续 configure 仍提示缺少某些库,只需根据报错信息用 yum search 找到对应的 -devel 包安装即可。

# 1.安装epel源
yum install -y epel-release
2.安装remi仓库
yum install -y https://rpms.remirepo.net/enterprise/remi-release-7.rpm
3.安装正则库(关键修复包)
yum install -y --enablerepo=remi oniguruma oniguruma-devel

这里通过 EPEL 和 Remi 两个第三方仓库来获取较新版本的软件包。其中 oniguruma(正则库)是整个安装链路中的关键一环——PHP 的 mbstring(多字节字符串)扩展在编译时必须依赖它来处理正则表达式匹配。CentOS 7 自带的 oniguruma 版本太旧,因此需要从 Remi 仓库安装新版 oniguruma-devel,否则 configure 阶段会直接报 oniguruma not found 错误而中断。

[root@server1 php-8.3.32]# ./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --enable-fpm --with-fpm-user=nginx --with-fpm-group=nginx --with-curl --with-iconv --with-mhash --with-zlib --with-openssl --enable-mysqlnd --with-mysqli --with-pdo-mysql --disable-debug --enable-sockets --enable-soap --enable-inline-optimization --enable-xml --enable-ftp --enable-gd --enable-exif --enable-mbstring --enable-bcmath --with-fpm-systemd

[root@server1 php-8.3.32]# make

此时会有报错,解决方案如下:

编译报错在 PHP 源码安装中非常常见,尤其是在 CentOS 7 这样系统库版本偏旧的发行版上。常见原因包括:OpenSSL 版本过低(PHP 8.x 要求 OpenSSL 1.0.2 以上)、cmake 版本不满足 libzip 的构建要求(libzip 1.9+ 需要 cmake 3.x,而 CentOS 7 自带的是 2.8)、libzip 版本不够新(PHP 8.x 的 zip 扩展需要 libzip 1.7+)。下面的解决方案按「先升级 OpenSSL → 再升级 cmake → 最后升级 libzip」的顺序逐一处理

卸载老版本openssl

[root@server1 ~]# yum remove -y openssl-devel

升级openssl版本

wget https://www.openssl.org/source/openssl-1.1.1w.tar.gz

tar -xf openssl-1.1.1w.tar.gz

cd openssl-1.1.1w

./config shared zlib --prefix=/usr/local/openssl

make -j$(nproc)

make install

核心环境变量

export PKG_CONFIG_PATH=/usr/local/openssl/lib/pkgconfig:$PKG_CONFIG_PATH

动态链接库注册

echo "/usr/local/openssl/lib" > /etc/ld.so.conf.d/openssl.conf

ldconfig

验证pkg-config能否识别

pkg-config --modversion openssl

升级cmake

[root@server1 ~]# wget -O /etc/yum.repos.d/epel.repo https://mirrors.aliyun.com/repo/epel-7.repo

[root@server1 ~]# yum install -y cmake3

[root@server1 ~]# ln -s /usr/bin/cmake3 /usr/bin/cmake

升级libzip

[root@server1 ~]# wget https://libzip.org/download/libzip-1.9.2.tar.gz

[root@server1 ~]# tar -xf libzip-1.9.2.tar.gz
[root@server1 ~]# cd libzip-1.9.2

[root@server1 libzip-1.9.2]# mkdir build && cd build

[root@server1 build]# cmake -DCMAKE_INSTALL_PREFIX=/usr/local/libzip -DBUILD_SHARED_LIBS=ON ..
[root@server1 build]# make -j$(nproc)

[root@server1 build]# make install

注册动态链接库

[root@server1 build]# echo "/usr/local/libzip/lib64" > /etc/ld.so.conf.d/libzip.conf

[root@server1 build]# ldconfig

设置环境变量

export PKG_CONFIG_PATH=/usr/local/libzip/lib64/pkgconfig

验证是否识别成功

pkg-config --modversion libzip

[root@server1 php-8.3.32]# yum install -y libjpeg-turbo-devel freetype-devel libpng-devel curl-devel readline-devel

[root@server1 php-8.3.32]# ./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --enable-fpm --with-fpm-user=nginx --with-fpm-group=nginx --enable-cli --enable-opcache --enable-mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --enable-mbstring --enable-xml --enable-gd --with-zip=/usr/local/libzip --with-curl --with-jpeg --with-freetype --with-openssl=/usr/local/openssl --enable-bcmath --enable-soap --enable-sockets --enable-exif --with-readline --with-zlib

[root@server1 php-8.3.32]# make -j$(nproc)

[root@server1 php-8.3.32]# make install

php配置

PHP 编译安装完成后,接下来需要对其运行环境进行配置。PHP-FPM(FastCGI Process Manager)是 PHP 的 FastCGI 实现,作为独立的服务进程与 Nginx 通信处理 PHP 请求。配置工作围绕以下几个核心文件展开:php-fpm.conf(FPM 主配置)、www.conf(进程池配置)、php.ini(PHP 运行时配置)以及 php-fpm.service(systemd 服务单元文件)。下面逐一说明各文件的作用和配置要点。

首先,PHP 源码安装默认不会生成现成的配置文件,需要从源码包中复制模板文件。进入 /usr/local/php/etc 目录后,cp php-fpm.conf.default php-fpm.conf 生成 FPM 主配置文件。该文件定义了全局设置,包括错误日志路径、进程 pid 文件位置、以及通过 include 指令引入子配置文件(如 www.conf)。比如 pid = run/php-fpm.pid 指定了进程 ID 文件的存放位置,error_log = log/php-fpm.log 则用于记录 FPM 运行时的错误信息。

接下来配置 www.conf,它定义了具体的进程池(pool)。一个进程池就是一组 PHP-FPM 工作进程,负责处理来自 Nginx 的 FastCGI 请求。关键参数包括:user 和 group(指定工作进程的运行用户,通常设为 nginx)、listen(监听地址,默认 127.0.0.1:9000 或套接字文件)、pm(进程管理模式,推荐使用 dynamic)、pm.max_children(最大子进程数)等。这些参数直接影响 PHP 处理请求的并发能力和资源占用,建议根据服务器内存和业务负载合理调整。

配置完进程池后,需要设置 PHP 运行时参数。将源码包根目录下的 php.ini-production 复制到 /usr/local/php/etc/php.ini。这是 PHP 的核心配置文件,控制着错误报告级别、内存限制(memory_limit)、上传文件大小(upload_max_filesize)、POST 数据大小(post_max_size)以及扩展加载等数百个选项。php.ini-production 模板采用了适合生产环境的安全默认值(例如关闭错误显示、限制内存使用),是推荐的配置起点。如果需要开启调试,可使用 php.ini-development 模板,它会启用详细错误信息和日志记录。

最后,为了让 PHP-FPM 能够通过 systemd 进行服务管理(如开机自启、重启、状态查询),需要将 sapi/fpm/php-fpm.service 文件复制到 /usr/lib/systemd/system/ 目录。编辑该服务文件,确保 ExecStart 指向正确的 PHP-FPM 可执行文件路径,并注释或删除不必要的环境变量设置。配置完成后,使用 systemctl start php-fpm 启动服务,systemctl enable php-fpm 设置开机自启,即可让 PHP-FPM 随系统启动而自动运行。

[root@server1 php-8.3.32]# cd /usr/local/php/etc

[root@server1 etc]# cp php-fpm.conf.default php-fpm.conf

[root@server1 etc]# vim php-fpm.conf

取消注释

[root@server1 etc]# cd php-fpm.d/

[root@server1 php-fpm.d]# cp www.conf.default www.conf

拷贝主配置文件

[root@server1 php-8.3.32]# cp php.ini-production /usr/local/php/etc/php.ini

[root@server1 php-8.3.32]# vim /usr/local/php/etc/php.ini

[root@server1 php-8.3.32]# cd sapi/fpm

[root@server1 fpm]# cp php-fpm.service /usr/lib/systemd/system

[root@server1 fpm]# vim /usr/lib/systemd/system/php-fpm.service

注释红色框中内容

nginx和php整合

[root@server1 ~]# cd /usr/local/nginx/conf/

[root@server1 conf]# vim nginx.conf

location ~ \.php$ {

root html;

fastcgi_pass 127.0.0.1:9000;

fastcgi_index index.php;

#fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;

include fastcgi.conf;

}

[root@server1 conf]# nginx -s reload

[root@server1 conf]# vim /usr/local/nginx/html/index.php

<?php

phpinfo()

?>

测试: http://192.168.247.129/index.php

php动态模块扩展

添加php环境变量

[root@server1 ~]# vim .bash_profile

[root@server1 ~]# source .bash_profile

模块下载

[root@server1 ~]# wget https://pecl.php.net/get/memcache-8.2.tgz

[root@server1 ~]# tar xf memcache-8.2.tgz
[root@server1 ~]# cd memcache-8.2/

[root@server1 memcache-8.2]# yum install -y autoconf

[root@server1 memcache-8.2]# ./configure

[root@server1 memcache-8.2]# make && make install

[root@server1 memcache-8.2]# php -m |grep memcache

无输出,代表 PHP 还没有加载 memcache 扩展,需要修改 php.ini

[root@server1 memcache-8.2]# cd /usr/local/php/etc

[root@server1 etc]# vim php.ini

extension=memcache #添加memcache模块

[root@server1 etc]# systemctl reload php-fpm (php-fpm 平滑重启,读取新的 php.ini 配置,加载 memcache 扩展。)

有输出,证明 memcache 扩展在 PHP CLI 模式加载完成。

部署测试页面到网站根目录

[root@server1 memcache-8.2]# cp example.php memcache.php /usr/local/nginx/html/

安装并启动 memcached 服务端

yum install -y memcached
systemctl enable --now memcached

验证 memcached 端口监听

修改 memcache.php 监控页面配置

[root@server1 memcache-8.2]# cd /usr/local/nginx/html/

[root@server1 html]# vim memcache.php

测试

访问http://192.168.247.129/example.php,多刷新几次页面

查看缓存命中状态

http://192.168.247.129/memcache.php

Nginx高效缓存

Nginx配置高速缓存

[root@server1 html]# cd /root/nginx-1.30.4
[root@server1 nginx-1.30.4]# make clean

[root@server1 nginx-1.30.4]# ./configure --with-http_ssl_module --with-http_stub_status_module --add-module=../echo-nginx-module-master --add-module=../memc-nginx-module-master --add-module=../srcache-nginx-module-master --with-cc-opt="-I/usr/local/openssl/include" --with-ld-opt="-L/usr/local/openssl/lib -Wl,-rpath=/usr/local/openssl/lib"

[root@server1 nginx-1.30.4]# make
[root@server1 nginx-1.30.4]# cd objs

[root@server1 objs]# cp nginx /usr/local/nginx/sbin/nginx

[root@server1 objs]# vim /usr/local/nginx/conf/nginx.conf

upstream memcache {

server 127.0.0.1:11211;

keepalive 512;

}

location /memc {

internal;

memc_connect_timeout 100ms;

memc_send_timeout 100ms;

memc_read_timeout 100ms;

set $memc_key $query_string;

set $memc_exptime 300;

memc_pass memcache;

}

location ~ \.php$ {

set $key $uri$args;

srcache_fetch GET /memc $key;

srcache_store PUT /memc $key;

root html;

fastcgi_pass 127.0.0.1:9000;

fastcgi_index index.php;

#fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;

include fastcgi.conf;

}

压测

[root@server2 ~]# ab -c 10 -n 5000 http://192.168.247.129/memcache.php

openresty部署

首先停止nginx服务,避免端口冲突

[root@server1 ~]# nginx -s stop

配置yum源

[root@server1 ~]# curl https://openresty.org/package/rhel/openresty.repo -o /etc/yum.repos.d/openresty.repo

[root@server1 ~]# yum install -y openresty

[root@server1 ~]# cd /usr/local/openresty/nginx/conf

[root@server1 conf]# cp /usr/local/nginx/conf/nginx.conf .

[root@server1 conf]# cp /usr/local/nginx/conf/cert.pem .

检测语法

[root@server1 conf]# /usr/local/openresty/nginx/sbin/nginx -t

启动openresty

[root@server1 conf]# /usr/local/openresty/nginx/sbin/nginx

[root@server1 ~]# cd /usr/local/nginx/html


[root@server1 html]# cp example.php  memcache.php index.php /usr/local/openresty/nginx/html/

浏览器访问

Session共享

部署tomcat

[root@server2 ~]# yum install -y java-1.8.0-openjdk.x86_64

[root@server2 ~]# wget https://downloads.apache.org/tomcat/tomcat-9/v9.0.120/bin/apache-tomcat-9.0.120.tar.gz

[root@server2 ~]# tar zxf apache-tomcat-9.0.120.tar.gz  -C /usr/local/

[root@server2 ~]# cd /usr/local/

[root@server2 local]# ln -s apache-tomcat-9.0.120/ tomcat

[root@server2 local]# cd tomcat/

启动服务

[root@server2 tomcat]# bin/startup.sh

访问:http://192.168.247.130:8080/

server3上同理部署

nginx整合tomcat

[root@server1 ~]# cd /usr/local/nginx/conf

[root@server1 conf]# vim nginx.conf

upstream tomcat{
        sticky cookie srv_id expires=1h;
        server 192.168.247.130:8080;
        server 192.168.247.132:8080;
        }
 

location ~ \.jsp$ {

proxy_pass http://tomcat;

}

[root@server1 conf]# nginx -s reload

在server2和server3上拷贝测试页面

[root@server2 ~]# cd /usr/local/tomcat/webapps/ROOT/

测试: http://192.168.247.129/test.jsp

停止server2上的tomcat服务

[root@server2 ~]# cd /usr/local/tomcat

[root@server2 tomcat]# bin/shutdown.sh

nginx对后端tomcat具有健康检测功能,自动切到server3上的tomcat服务,但是在server2上提交的session信息全部丢失。

tomcat整合memcached

tomcat服务通过msm模块把session信息交叉存储到memcached上

[root@server2 tomcat]# yum install -y memcached

[root@server2 ~]# systemctl enable --now memcached

[root@server2 ~]# netstat -antlp|grep :11211

server3也同样进行上述操作

先下载好msm.tgz包

[root@server2 ~]# tar zxf msm.tgz

[root@server2 msm]# cp * /usr/local/tomcat/lib/

[root@server2 msm]# scp * server3:/usr/local/tomcat/lib/

[root@server2 msm]# vim /usr/local/tomcat/conf/context.xml

<Manager className="de.javakaffee.web.msm.MemcachedBackupSessionManager"

memcachedNodes="n1:192.168.247.130:11211,n2:192.168.247.132:11211"

failoverNodes="n1" #server3上修改为n2

requestUriIgnorePattern=".*\.(ico|png|gif|jpg|css|js)$"

transcoderFactoryClass="de.javakaffee.web.msm.serializer.kryo.KryoTranscoderFactory"

/>

重启tomcat

[root@server2 tomcat]# bin/shutdown.sh

[root@server2 msm]# cd /usr/local/tomcat

[root@server2 tomcat]# bin/startup.sh

查看日志

[root@server2 tomcat]# cat logs/catalina.out

server3上也进行同样的操作

测试

http://192.168.247.129/test.jsp

关闭server3上的tomcat服务后会自动切换到server2

[root@server3 tomcat]# bin/shutdown.sh

关闭server2上的memcached服务后,会自动切换到server3上的memcached服务

[root@server2 tomcat]# systemctl stop memcached

手把手教你学Simulink--基于光伏(PV)系统的建模与仿真场景:-不同天气条件下光伏系统的输出性能分析 本文介绍了使用Simulink和Simscape Electrical工具箱进行光伏系统建模与仿真的完整流程。内容涵盖准备工作、模型构建、仿真分析三大步骤,重点演示了如何模拟不同天气条件(光照强度、温度变化)对光伏输出性能的影响。通过添加PVArray模块、配置参数、设置环境变化条件、连接测量仪器等操作,实现了光伏系统在动态天气条件下的输出特性分析。文章还提供了仿真参数设置建议和结果分析方法,帮助用户理解环境因素与光伏性能的关联性,为光伏系统设计和优化提供参考。 阅读详情

相关推荐

从示波器波形看懂CAN/RS485/RS422:一个TVS管放错位置,通信全挂的教训

本文通过示波器波形分析,深入探讨了CAN/RS485/RS422通信系统中TVS管布局错误的故障诊断与解决方案。文章详细解析了错误布局导致的波形特征,如信号钳位、阻抗失配等,并提供了正确的保护电路设计方案和终端匹配技术,帮助工程师快速定位和解决通信故障。

weixin_30555515的博客 346

LAMP架构【1】

LAMP架构介绍 MySQL、MariaDB介绍 MySQL安装 MariaDB安装 Apache安装 安装PHP5 安装PHP7 Apache和PHP结合 一、LAMP架构介绍 LAMP是Linux apache MySQL php的简写,即可吧apache MySQL和PHP安装在Linux系统上, 组成一个坏境来运行PHP的脚本语言,通常是网站。 Linux是...

weixin_42604768的博客 3236

西门子PLC1200与CB1241模块的Modbus RTU从站配置全流程(附串口调试技巧)

本文详细介绍了西门子S7-1200 PLC与CB1241通信模块实现Modbus RTU从站配置的全流程,包括硬件接线规范、TIA Portal工程组态、通信指令编程及串口调试技巧。通过实战案例和常见错误处理方案,帮助工程师快速搭建稳定的工业通信系统,提升自动化设备的互联互通能力。

weixin_29165725的博客 325

1. LAMP架构概述+论坛

1. LAMP动态网站架构组成 lamp的全称是linux+apache+mysql+php

m0_52454621的博客 332

LC滤波器设计实战:从理论计算到PCB布局的完整指南

滤波器是信号处理与电路设计中的基础组件,用于从复杂信号中提取特定频率分量或抑制干扰噪声。其核心原理基于电感(L)和电容(C)等无源元件的频率选择特性,通过特定的网络拓扑实现幅频与相频特性的塑造。在工程实践中,LC滤波器因其结构简单、可靠性高、成本可控,成为射频、模拟及电源电路中的关键技术手段。其设计价值在于将理论网络综合转化为可量产、高性能的硬件解决方案,广泛应用于通信系统、音频处理、电源净化和传感器信号调理等场景。本文聚焦于LC滤波器的工程设计全流程,深入剖析了巴特沃斯、切比雪夫等经典类型的选型权衡,并重

weixin_34194829的博客 273

教你读懂techpoint视频解码芯片tp2855规格书(第一部分)

所有的控制环都是可编程的,以实现最大化的灵活性。对于NTSC/PAL输入,输出时钟和采样结构是非标准的,以便在多路复用输出时与HD格式一同工作。所有通道的音频数据都可以选择性地级联,以实现最大的灵活性。TP2855是一款通用的高清/标清视频解码器芯片,其支持对HD-TVI、NTSC/PAL制式960H分辨率及普通AHD视频格式的解码。TP2855具有内部钳位,在每个通道上都有自动增益控制放大器,用于最佳的信号调节。即使在使用低质量和长线缆的条件下,它的可编程均衡放大器和自动控制环也能维持尚佳的表现。

hufan92的博客 4918

LAMP架构 1

LAMP架构介绍   LAMP是Linux、Apache(httpd)、MySQL、PHP的简写,就是把Apache、MySQL、以及PHP安装在Linux上面,组成一个环境来运行PHP的脚本语言,通常是网站。 PHP网站 Goole、淘宝、百度等 3个角色可以在一台机器、也没有分开(httpd和PHP要在一起)。例如可以把Apache+PHP安装在一台机器上,再把MySQL安装在另一台机...

aaahai的博客 437

单路径微分相除和微分自乘相减算法(PGC-SDD-DSM)

PGC-SDD-DSM算法通过融合单路微分相除和差分自乘,解决了传统PGC解调技术对调制深度和光强干扰敏感的问题,显著提升了解调稳定性和抗失真能力。其高信噪比、低谐波失真以及对参数变化的鲁棒性,使其在光纤传感领域具有重要应用价值。PGC-SDD-DSM算法在计算复杂度方面具有显著的优势,主要体现在其高稳定性和低谐波失真上。这些优势使其在光纤光学干涉传感器中表现出色,尤其是在面对光强干扰和调制深度变化时。

百态·数智思维 | 聚焦大数据、量化与未来AI 841

LAMP架构(1)

LAMP环境搭建与配置 任务1 安装LAMP,基础配置解析PHP 一.安装MySQL 1)下载源码包并放在/usr/local/src/目录中 下载源码包:mysql-5.6.43-linux-glibc2.12-x86_64.tar # wget mysql-5.6.43-linux-glibc2.12-x86_64.tar [root@localhost ~]# ls anaconda-ks.cfg mysql-5.7.32-linux-glibc2.12-x86_64.tar.gz wordpres

qq_51085767的博客 192

AIoT 在线工程实训平台案例——智能家居

AIoT 在线工程实训平台案例——智能家居的操作步骤

m0_53608652的博客 1430

LeRobot — 基于 PyTorch 的真实世界机器人学习框架(一)- 核心框架模块解析

LeRobot 是一个开源的机器人学习框架,由 Hugging Face 开发,旨在降低机器人学的准入门槛。该框架提供完整的机器学习流程支持,包括数据采集、训练、评估和部署。核心模块涵盖数据集标准化、策略算法、硬件抽象和强化学习组件,采用模块化设计实现灵活扩展。通过集成 Hugging Face Hub,用户可以轻松共享数据集和预训练模型。LeRobot 特别注重真实世界的机器人应用,支持多种前沿算法如模仿学习、视觉语言动作模型等,并提供统一的硬件接口和仿真环境适配。

熊猫小妖的AI世界 171

LAMP 系统性能调优,第 1 部分: 理解 LAMP 架构

Linux、Apache、MySQL 和 PHP(或 Perl)是许多 Web 应用程序的基础 —— 从 to-do 列表到 blog,再到电子商务站点。WordPress 和 Pligg 是两个支持大容量 Web 站点的常用软件包。这种架构简称为 LAMP。几乎每个 Linux 发布版都包含 Apache、MySQL、PHP 和 Perl,所以安装 LAMP 软件是非常容易的。 安装的简便

吸星大法--吸百家武学之精华。大成也 696

PCIE2.0/PCIE3.0/PCIE4.0/PCIE5.0接口的带宽、速率计算

一、PCIE接口速率: 二、PCIE相关概念: 传输速率为每秒传输量GT/s,而不是每秒位数Gbps,因为传输量包括不提供额外吞吐量的开销位; 比如 PCIe 1.x和PCIe 2.x使用8b / 10b编码方案,导致占用了20% (= 2/10)的原始信道带宽。 GT/s —— Giga transation per second (千兆传输/秒),即每一秒内传输的次数。重点在于描述物理层通信协议的速率属性,可以不和链路宽度等关联。 Gbps —— Giga Bits Per Second

技术联盟 1万+

LAMP架构(1) LAMP架构介绍,MySQL和MariaDB介绍,MySQL安装,MariaDB安装

LAMP架构 LAMP和LNMP是目前流行的web服务器架构,市场占有率超过80%,所谓LAMP架构,实际上指的是Linux+Apache+MySQL+PHP组合。Linux, 就是我们现在使用的操作系统,作为平台来承载搭建的服务。Apache,实指apche项目里的httpd软件,用来搭建web服务,http协议和tomcat也属此项目开发的。MySQL,是一个高效,多线程、多用户...

langyue919的博客 675

pscad IEEE标准系统搭建说明

pscad IEEE标准系统搭建说明,包含典型的IEEE 9节点、14节点、30节点、39节点和118节点系统。内含标准测试系统的原始数据和潮流结果。

Data-Structures-and-Algorithm-Analysis-in-Java.pdf

作者: Weiss, Mark A. 出版社: Addison Wesley Data Structures and Algorithm Analysis in Java is an “advanced algorithms” book that fits between traditional CS2 and Algorithms Analysis courses. In the old ACM Curriculum Guidelines, this course was known as CS7. This text is for readers who want to learn good programming and algorithm analysis skills simultaneously so that they can develop such programs with the maximum amo...

lamp架构(1)安装

lamp架构一、安装mysql1.下载mysql包到src2. 一、安装mysql 1.下载mysql包到src wget http://mirrors.sohu.com/mysql/MySQL-5.6/mysql-5.6.35-linux-glibc2.5-x86_64.tar.gz 解压 tar -zxf mysql-5.6.47-linux-glibc2.12-x86_64.tar.gz 将解压的目录移动并改名 mv mysql-5.6.47-linux-glibc2.12-x86_64 /usr

qq_52619275的博客 541

jre9下载 jdk9

(Java SE Runtime Environment 9.0) 9.0u175 官方最新版 【x86|x64】

LAMP架构(1)

一.LAMP架构介绍  httpd、PHP、MySQL三者如何工作   Apache不能直接和Mysql进行通讯,只能通过PHP模块进行通讯  Apache和PHP必须安装在同一台Linux机器  Apcche通过PHP和Mysql进行通讯,该过程为动态请求 1. PHP作为一种后台操作语言,类似asp,可以制作web页面,创建ajax请求,访问数据库的请求,操作数据库表格等。 2....

xzl18779631005的博客 403

精雕软件(JDpaint) 5.5 绿色版

精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版

LAMP架构 (1)

内容摘要: LAMP架构介绍 MySQL、MariaDB介绍 MySQL安装 MariaDB安装 Apache安装 安装PHP5 安装PHP7 Apache和PHP结合 扩展 一、LAMP架构介绍 LAMP的架构组成包括: Linxu + Apache(httpd)+MySQL+PHP Apache 提供web服务 MySQL 动态的数据库 PHP 编程语言,比...

CN_SHzhaoyujie的博客 379

搭建LAMP架构— 1、手工编译安装Apache

LAMP(Linux-Apache-MySQL-PHP)网站架构是目前国际流行的Web框架,该框架包括:Linux操作系统,Apache网络服务器,MySQL数据库,Perl、PHP或者Python编程语言,所有组成产品均是开源软件,是国际上成熟的架构框架,很多流行的商业应用都是采取这个架构,和Java/J2EE架构相比,LAMP具有Web资源丰富、轻量、快速开发等特点,微软的.NET架构相比,L...

weixin_33929309的博客 382

LAMP架构_1

LAMP架构 实验环境:RHEL6.0 Server IP:192.168.0.1 1.需要的源码安装包: httpd http://httpd.apache.org/ mysql http://www.mysql.com/downloads/mysql/#downloads php...

weixin_34255793的博客 106

11.1 LAMP架构介绍

2019独角兽企业重金招聘Python工程师标准>>> ...

weixin_33729196的博客 121

[转]LAMP 系统性能调优,第 1 部分: 理解 LAMP 架构

文章来源:http://www.ibm.com/developerworks/cn/linux/l-tune-lamp-1/index.html LAMP 系统性能调优,第 1 部分: 理解 LAMP 架构 LAMP 系统的工作原理、性能度量方法及底层操作系统的调优方法 文档选项

web专栏 361

LAMP 系统性能调优第1 部分: 理解LAMP 架构

级别: 中级Sean A. Walberg (sean@ertw.com), 高级网络工程师2007 年 5 月 09 日如今,使用 LAMP(Linux®、Apache、MySQL 和 PHP/Perl)架构的应用程序不断被开发和部署。 但是,服务器管理员对应用程序本身几乎没有控制能力,因为应用程序是别人编写的。这份共三部分的系列文章将讨论许多服务器配置问题,这些配置会影响应用程序的

技术资料库 1198
上一篇: 【负载均衡与高可用】
下一篇: 【LAMP架构-2】
insertYam
博客等级 码龄3年 2粉丝 22原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值