Redis 安装部署

文章目录

  • 1、前言
  • 2、安装部署
    • 2.1、单机模式
      • 2.1.1、通过 yum 安装(不推荐,版本老旧)
      • 2.1.1、通过源码编译安装(推荐)
    • 2.2、主从模式
    • 2.3、哨兵模式
    • 2.4、集群模式
    • 2.5、其他命令
    • 2.6、其他操作系统
  • 3、使用
    • 3.1、Java 代码 —— SpringBoot
  • 4、总结


1、前言

参考文档:

  • Redis 官网
  • Redis 官方下载地址
  • 相关文章:Redis 四种模式的介绍

环境说明:

  • 操作系统版本:CentOS Linux release 7.9.2009 (Core)
  • 操作系统安装包:CentOS-7-x86_64-Minimal-2009.iso
  • Redis 版本:7.2.3
  • Redis 客户端(Windows):RedisDesktopManager 0.8.3.3850
  • Redis 客户端(Windows)安装文件:redis-desktop-manager-0.8.3.3850.exe

2、安装部署

2.1、单机模式

Redis 可通过 yum 进行安装部署,但是默认安装的版本比较老旧,配置第三方非官方源存在一定风险。因此,安装部署较新版本最安全的方法,是需要通过 Redis 源码编译,进行安装的方式。

服务器配置如下:

序号服务器IP服务器配置说明
1192.168.2.1314C 8G源码编译(资源多点吧,要不有点慢)

2.1.1、通过 yum 安装(不推荐,版本老旧)

# 安装 epel 源
yum install epel-release
# 安装 Redis
yum install redis
# Redis 版本 3.2.12-2.el7
# 查看安装版本
redis-server --version
# Redis server v=3.2.12 sha=00000000:0 malloc=jemalloc-3.6.0 bits=64 build=7897e7d0e13773f
# 卸载
rpm -e redis

2.1.1、通过源码编译安装(推荐)

Redis 源码下载地址

安装

# 安装相关依赖
yum -y install wget python3 gcc
# 安装目录
cd /opt
# 获取源码
wget https://codeload.github.com/redis/redis/tar.gz/refs/tags/7.2.3
# 解压
tar -zxvf 7.2.3
# 进入目录
cd redis-7.2.3
# 编译 && 安装
make && make install
# 启动服务(未更改配置,需要新窗口启动 redis-cli 客户端)
# redis-server
# 创建日志目录
mkdir logs
# 后台启动服务(未更改默认配置文件)
nohup redis-server redis.conf >./logs/stdout.log 2>&1 &

测试

# 通过 Redis 客户端访问 Redis 服务
[root@localhost redis-7.2.3]# redis-cli
127.0.0.1:6379> ping
PONG

# redis-cli -h 192.168.56.108

配置文件没有变更,使用源码默认配置文件。此时,只能本地通过 redis-cli 客户端进行访问。需要通过网络访问,需要修改配置文件 redis.conf

vi /opt/redis-7.2.3/redis.conf

更改内容如下

bind 0.0.0.0
# 不设置 bind IP 和密码,只允许本地通过 127.0.0.1:6379 访问,拒绝远程访问
protected-mode no
# 默认密码
requirepass foobared

重启服务

# 停止服务
[root@localhost redis-7.2.3]# ps -ef|grep redis
root      6747  1530  0 14:07 pts/0    00:00:00 src/redis-server 127.0.0.1:6379
root      6776  1530  0 14:09 pts/0    00:00:00 grep --color=auto redis
[root@localhost redis-7.2.3]# kill 6747
# 或者
pgrep -f redis-server | xargs kill
# 或者
[root@localhost redis-7.2.3]# redis-cli
127.0.0.1:6379> shutdown
not connected>

# 启动服务
cd /opt/redis-7.2.3
nohup redis-server redis.conf >./logs/stdout.log 2>&1 &
ss -ntl|grep 6379

# 防火墙开放端口
firewall-cmd --zone=public --add-port=6379/tcp --permanent
systemctl restart firewalld.service
firewall-cmd --zone=public --list-ports

测试
通过 redis-cli 连接测试

[root@localhost redis-7.2.3]# redis-cli -c -h 192.168.2.131 -a foobared
Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe.
192.168.2.131:6379> ping
PONG
192.168.2.131:6379> exit
[root@localhost redis-7.2.3]#

通过 Windows 客户端进行连接测试

在这里插入图片描述

在这里插入图片描述

至此,单机部署完成。
提示:生产环境,请根据需求进行参数优化配置!


2.2、主从模式

相关文章:主从模式的原理介绍

服务器配置如下:

序号服务器IP服务器配置说明
1192.168.2.1314C 8G源码编译(资源多点吧,要不有点慢)主节点
2192.168.2.1321C 1G从节点

将编译好的 Redis 文件夹压缩,传给从节点

主节点操作

# 停止服务
pgrep -f redis-server | xargs kill
# 压缩文件夹为 tar 包
tar -cf redis-7.2.3.tar redis-7.2.3
# 启动服务
nohup redis-server redis.conf >./logs/stdout.log 2>&1 &

从节点操作

cd /opt
# copy 主节点压缩包
scp 192.168.2.131://opt/redis-7.2.3.tar ./
# 输入主节点服务器密码
# 解压
tar -xf redis-7.2.3.tar

说明:

  • 主节点配置与单机部署相同,无需变更
  • 从节点配置 redis.conf 在单节点配置基础上增加
# 主节点 IP 端口
replicaof 192.168.2.131 6379
# 主节点密码
masterauth foobared

启动服务

# 安装服务
cd /opt/redis-7.2.3
make install
# 启动服务
nohup redis-server redis.conf >./logs/stdout.log 2>&1 &
# 查看日志
tail -100f logs/stdout.log
# 其中显示
MASTER <-> REPLICA sync: Finished with success

# 防火墙开放端口
firewall-cmd --zone=public --add-port=6379/tcp --permanent
systemctl restart firewalld.service
firewall-cmd --zone=public --list-ports

验证
通过客户端在 131 主节点进行操作,132 会进行数据同步。包括:新增、更新、删除。

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

至此,主从模式部署完成。
提示:生产环境,请根据需求进行参数优化配置!


2.3、哨兵模式

服务器配置如下:

序号服务器IP服务器配置说明
1192.168.2.1314C 8G源码编译(资源多点吧,要不有点慢)主节点 + 哨兵
2192.168.2.1321C 1G从节点+ 哨兵
3192.168.2.1331C 1G哨兵

说明:

  • 主从模式下,增加哨兵
  • 哨兵模式可通过代码进行验证

将主节点的 tar 包 copy 到 哨兵节点

cd /opt
# copy 主节点压缩包
scp 192.168.2.131://opt/redis-7.2.3.tar ./
# 输入主节点服务器密码
# 解压
tar -xf redis-7.2.3.tar

哨兵配置 /opt/redis-7.2.3/sentinel.conf (3个节点都需要配置)

# protected-mode no # 默认配置,无需更改
# 哨兵监控的主节点 IP 端口 2个哨兵节点同时判断redis节点异常才有效
sentinel monitor mymaster 192.168.2.131 6379 2
# 主节点密码
sentinel auth-pass mymaster foobared

启动服务(3个节点都需要启动哨兵服务)

# 安装服务
cd /opt/redis-7.2.3
make install
# 启动哨兵服务
nohup src/redis-sentinel sentinel.conf >./logs/sentinelStdout.log 2>&1 &
# 通过查看端口监测情况,验证哨兵是否正常启动
ss -ntl|grep 26379

# 开放防火墙端口
firewall-cmd --zone=public --add-port=26379/tcp --permanent
systemctl restart firewalld.service
firewall-cmd --zone=public --list-ports

其他命令

# 停止哨兵服务
pgrep -f redis-sentinel | xargs kill

至此,哨兵模式部署完成。
提示:生产环境,请根据需求进行参数优化配置!


2.4、集群模式

相关参考文档:Redis 集群搭建

说明:

  • Redis 集群对节点数要求为奇数,因此至少需要三个节点,并且每个节点至少有一个备份节点。结论:Redis 集群至少6个 redis 节点。
  • 节点可部署在相同的服务器,但是生产环境不推荐,避免服务器故障引起集群不可用
  • 集群模式可通过代码进行验证

服务器配置如下:

序号服务器IP服务器配置说明
1192.168.2.1314C 8G源码编译(所以资源多点),主从关系自动分配,无法提前确认
2192.168.2.1321C 1G主从关系自动分配,无法提前确认
3192.168.2.1331C 1G主从关系自动分配,无法提前确认
4192.168.2.1341C 1G主从关系自动分配,无法提前确认
5192.168.2.1351C 1G主从关系自动分配,无法提前确认
6192.168.2.1361C 1G主从关系自动分配,无法提前确认

安装依赖

yum -y install ruby

开放相关端口

端口列表参考文档

firewall-cmd --zone=public --add-port=6379/tcp --add-port=16379/tcp --add-port=6380/tcp --add-port=26379/tcp --permanent
systemctl restart firewalld.service
firewall-cmd --zone=public --list-ports

单机部署配置下 redis.conf 增加相关配置(注意:主从模式、哨兵模式产生的数据对集群模式有影响。如果无法确认影响程度,那干脆将虚拟机恢复到干净的快照,再进行相关操作!)

# 开启集群模式
cluster-enabled yes
# 集群配置文件(首次自动生成)
cluster-config-file nodes-6379.conf

生成压缩包,准备发送到其余 5 个节点

# 停止服务
pgrep -f redis-server | xargs kill
# 压缩文件夹为 tar 包
tar -cf redis-7.2.3.tar redis-7.2.3

启动服务(6个节点全部启动)

tar -xf redis-7.2.3.tar
cd redis-7.2.3
make install
nohup redis-server redis.conf >./logs/stdout.log 2>&1 &

创建集群(注意:在任意一台上运行,不要在每台机器上都运行,运行一次即可)

[root@localhost redis-7.2.3]# redis-cli --cluster create 192.168.2.131:6379 192.168.2.132:6379 192.168.2.133:6379 192.168.2.134:6379 192.168.2.135:6379 192.168.2.136:6379 --cluster-replicas 1 -a foobared
Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe.
>>> Performing hash slots allocation on 6 nodes...
Master[0] -> Slots 0 - 5460
Master[1] -> Slots 5461 - 10922
Master[2] -> Slots 10923 - 16383
Adding replica 192.168.2.135:6379 to 192.168.2.131:6379
Adding replica 192.168.2.136:6379 to 192.168.2.132:6379
Adding replica 192.168.2.134:6379 to 192.168.2.133:6379
M: 8ad6b5f89470f24c7c747ede0532f3c58665a36f 192.168.2.131:6379
   slots:[0-5460] (5461 slots) master
M: 068cb1887faef1e992e5fe4f63e04d3022016a73 192.168.2.132:6379
   slots:[5461-10922] (5462 slots) master
M: 8e55d559efad0bc6c06450c40e81f005ae2521a7 192.168.2.133:6379
   slots:[10923-16383] (5461 slots) master
S: 58b7d94d41c537252cb5f54918aae55fa09fc876 192.168.2.134:6379
   replicates 8e55d559efad0bc6c06450c40e81f005ae2521a7
S: c913f4da1d29ce54f6c062384aa8bfc6beaef553 192.168.2.135:6379
   replicates 8ad6b5f89470f24c7c747ede0532f3c58665a36f
S: 6337b662b08d4bd32388b18ccf687e87f9f09bc6 192.168.2.136:6379
   replicates 068cb1887faef1e992e5fe4f63e04d3022016a73
Can I set the above configuration? (type 'yes' to accept): yes
>>> Nodes configuration updated
>>> Assign a different config epoch to each node
>>> Sending CLUSTER MEET messages to join the cluster
Waiting for the cluster to join

>>> Performing Cluster Check (using node 192.168.2.131:6379)
M: 8ad6b5f89470f24c7c747ede0532f3c58665a36f 192.168.2.131:6379
   slots:[0-5460] (5461 slots) master
   1 additional replica(s)
M: 8e55d559efad0bc6c06450c40e81f005ae2521a7 192.168.2.133:6379
   slots:[10923-16383] (5461 slots) master
   1 additional replica(s)
M: 068cb1887faef1e992e5fe4f63e04d3022016a73 192.168.2.132:6379
   slots:[5461-10922] (5462 slots) master
   1 additional replica(s)
S: 6337b662b08d4bd32388b18ccf687e87f9f09bc6 192.168.2.136:6379
   slots: (0 slots) slave
   replicates 068cb1887faef1e992e5fe4f63e04d3022016a73
S: 58b7d94d41c537252cb5f54918aae55fa09fc876 192.168.2.134:6379
   slots: (0 slots) slave
   replicates 8e55d559efad0bc6c06450c40e81f005ae2521a7
S: c913f4da1d29ce54f6c062384aa8bfc6beaef553 192.168.2.135:6379
   slots: (0 slots) slave
   replicates 8ad6b5f89470f24c7c747ede0532f3c58665a36f
[OK] All nodes agree about slots configuration.
>>> Check for open slots...
>>> Check slots coverage...
[OK] All 16384 slots covered.

集群验证

[root@localhost redis-7.2.3]# redis-cli -c -h 192.168.2.131 -a foobared
Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe.
192.168.2.131:6379> set name userName
-> Redirected to slot [5798] located at 192.168.2.132:6379
OK
192.168.2.132:6379> get name
"userName"
192.168.2.132:6379> exit

至此,集群模式部署完成。
提示:生产环境,请根据需求进行参数优化配置!


2.5、其他命令

redis-server        //启动服务
redis-benchmark     //测试性能
redis-check-aof     //检查aof持久化文件
redis-sentinel 
redis-cli          //客户端

# 正式关闭redis服务
# 在redis-cli中,无 Authentication 才可以
shutdown

# 卸载redis
make uninstall
# 或者
rm -rf /usr/local/bin/redis-*
rm -rf /usr/local/redis

说明:make、 make install、make uninstall 的作用参考文档


2.6、其他操作系统

Ubuntu/Debian 安装部署,可参考官方文档


3、使用

3.1、Java 代码 —— SpringBoot

Java 版本:JDK 17.0.6
SpringBoot 版本: 3.0.2
IDE 版本:IntelliJ IDEA 2023.2.5 (Community Edition)
Postman 版本:November 2023 (v10.20)
其他配置:详情见 Demo 及相关配置图片

配置图片
请添加图片描述

SpringBoot 新建项目 Demo 下载地址

pom.xml 文件如下

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.example</groupId>
    <artifactId>demo</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>demo</name>
    <description>Demo project for Spring Boot</description>
    <properties>
        <java.version>17</java.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <spring-boot.version>3.0.2</spring-boot.version>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-redis</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
            <scope>runtime</scope>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>
    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-dependencies</artifactId>
                <version>${spring-boot.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.1</version>
                <configuration>
                    <source>17</source>
                    <target>17</target>
                    <encoding>UTF-8</encoding>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <version>${spring-boot.version}</version>
                <configuration>
                    <mainClass>com.example.demo.DemoApplication</mainClass>
                    <skip>true</skip>
                </configuration>
                <executions>
                    <execution>
                        <id>repackage</id>
                        <goals>
                            <goal>repackage</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

</project>

Spring 相关配置 application.yaml

# 应用服务 WEB 访问端口
server:
  port: 8080

spring:
  data:
    redis:
      password: foobared

#      # 直连 Redis
#      host: 192.168.2.131
#      port: 6379

#      # redis哨兵配置
#      sentinel:
#        # 主节点名称
#        master: mymaster
#        nodes:
#          - 192.168.2.131:26379
#          - 192.168.2.132:26379
#          - 192.168.2.133:26379

      # 集群的部署方式
      cluster:
        nodes:
          - 192.168.2.131:6379
          - 192.168.2.132:6379
          - 192.168.2.133:6379
          - 192.168.2.134:6379
          - 192.168.2.135:6379
          - 192.168.2.136:6379
        # 最大重定向次数(由于集群中数据存储在多个节点,所以在访问数据时需要通过转发进行数据定位)
        max-redirects: 2

#      # 其他相关配置
#      lettuce:
#        pool:
#          # 连接池中的最大空闲连接
#          max-idle: 10
#          # 连接池最大阻塞等待时间(使用负值表示没有限制)
#          max-wait: 500
#          # 连接池最大连接数(使用负值表示没有限制)
#          max-active: 8
#          # 连接池中的最小空闲连接
#          min-idle: 0

Demo 基础上增加 Redis 相关操作

增加 UserService

package com.example.demo.demos.service;

import com.example.demo.demos.web.User;
import jakarta.annotation.Resource;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;

@Service
public class UserService {

    @Resource
    private RedisTemplate redisTemplate;

    public User saveUser(User u) {
        String name = u.getName();
        redisTemplate.opsForValue().set(name, u.getAge());
        return findUser(name);
    }

    public User findUser(String username) {
        User user = new User();
        Integer age = (Integer) redisTemplate.opsForValue().get(username);
        user.setName(username);
        user.setAge(age);
        return user;
    }

}

变更 BasicController

package com.example.demo.demos.web;

import com.example.demo.demos.service.UserService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

@Controller
public class BasicController {

    @Resource
    private UserService userService;

    // http://127.0.0.1:8080/hello?name=lisi
    @RequestMapping("/hello")
    @ResponseBody
    public String hello(@RequestParam(name = "name", defaultValue = "unknown user") String name) {
        return "Hello " + name;
    }

    // http://127.0.0.1:8080/user?username=lisi
    @GetMapping("/user")
    @ResponseBody
    public User user(@RequestParam String username) {
        return userService.findUser(username);
    }

    // http://127.0.0.1:8080/save_user
    @PostMapping("/save_user")
    @ResponseBody
    public User saveUser(@RequestBody User u) {
        return userService.saveUser(u);
    }

}

启动服务,并通过访问接口地址进行相关验证

# 验证接口是否畅通
curl --location 'http://127.0.0.1:8080/hello?name=lisi'
# 添加数据
curl --location 'http://127.0.0.1:8080/save_user' \
--header 'Content-Type: application/json' \
--data '{
    "name": "lisi",
    "age": 18
}'
# 查询数据
curl --location 'http://127.0.0.1:8080/user?username=lisi'

4、总结

无论哪种 Redis 模式的安装,都不算复杂。阅读相关文档,理解好原理,安装部署都比较简单。
但是实际生产环境,仍存在比较复杂的实际使用场景,以及更加奇怪的问题有待我们去探索!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mfbz.cn/a/211939.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

吉他初学者学习网站搭建系列(4)——如何查询和弦图

文章目录 背景实现ChordDbvexchords 背景 作为吉他初学者&#xff0c;如何根据和弦名快速查到和弦图是一个必不可少的功能。以往也许你会去翻和弦的书籍查询&#xff0c;像查新华字典那样&#xff0c;但是有了互联网后我们不必那样&#xff0c;只需要在网页上输入和弦名&#…

react之ReactRouter的使用

react之ReactRouter的使用 一、环境搭建二、抽象路由模块三、路由导航3.1 声明式导航3.2 编程式导航 四、导航传参4.1 searchParams 传参4.2 params 传参 五 、嵌套路由配置六、默认二级路由七、404页面配置八、俩种路由模式 一、环境搭建 1.创建项目安装依赖 npx create-rea…

2024年美国大学生数学建模竞赛(MCM/ICM)论文写作方法指导

一、前言 谈笑有鸿儒&#xff0c;往来无白丁。鸟宿池边树&#xff0c;僧敲月下门。士为知己者死&#xff0c;女为悦己者容。吴楚东南坼&#xff0c;乾坤日夜浮。剪不断&#xff0c;理还乱&#xff0c;是离愁&#xff0c;别是一番滋味在心头。 重要提示&#xff1a;优秀论文的解…

Matlab 加权均值质心计算(WMN)

文章目录 一、简介二、实现代码三、实现效果参考资料一、简介 思路很简单,即将之前的均值中心,引入相关的权重函数(通常与距离有关),以此为每个点进行赋权,最后即可得到一个加权均值中心: 二、实现代码 %% ********<

[二分查找]LeetCode2009 :使数组连续的最少操作数

本文涉及的基础知识点 二分查找算法合集 作者推荐 动态规划LeetCode2552&#xff1a;优化了6版的1324模式 题目 给你一个整数数组 nums 。每一次操作中&#xff0c;你可以将 nums 中 任意 一个元素替换成 任意 整数。 如果 nums 满足以下条件&#xff0c;那么它是 连续的 …

ChatGPT 上线一周年

一年前&#xff0c;ChatGPT 正式上线&#xff0c;这无疑是个革命性的时刻&#xff0c;仅仅 6 周&#xff0c;ChatGPT 用户量达到 1 个亿。 这一年元宇宙作为概念垃圾彻底进入下水道&#xff0c;而 ChatGPT 和 AI 则席卷全球。 仅仅这一年&#xff0c;依托于 ChatGPT&#xff…

SmartSoftHelp8,数据库事务测试工具

SQL数据库事务测试工具 SQL数据库事务回滚测试工具 下载地址&#xff1a; https://pan.baidu.com/s/1zBgeYsqWnSlNgiKPR2lUYg?pwd8888

二分查找:LeetCode2035:将数组分成两个数组并最小化数组和的差

本文涉及的基础知识点 二分查找算法合集 作者推荐 动态规划LeetCode2552&#xff1a;优化了6版的1324模式 题目 给你一个长度为 2 * n 的整数数组。你需要将 nums 分成 两个 长度为 n 的数组&#xff0c;分别求出两个数组的和&#xff0c;并 最小化 两个数组和之 差的绝对…

nodejs微信小程序+python+PHP贵州旅游系统的设计与实现-计算机毕业设计推荐MySQL

目 录 摘 要 I ABSTRACT II 目 录 II 第1章 绪论 1 1.1背景及意义 1 1.2 国内外研究概况 1 1.3 研究的内容 1 第2章 相关技术 3 2.1 nodejs简介 4 2.2 express框架介绍 6 2.4 MySQL数据库 4 第3章 系统分析 5 3.1 需求分析 5 3.2 系统可行性分析 5 3.2.1技术可行性&#xff1a;…

巧用MACD精准抄底和逃顶

一、认识MACD MACD又称平滑异同移动平均线&#xff0c;是由美国投资家杰拉尔德阿佩尔在 20 世纪 70 年代末提出的。 MACD 指标的设计基于MA均线原理&#xff0c;是对收盘价进行平滑处理&#xff08;求出加权平均值&#xff09;后的一种趋向类指标。它是股票交易中一种常见的技术…

IDEA2023安装教程(超详细)

文章目录 前言安装IntelliJ IDEA1. 下载IntelliJ IDEA2. 运行安装程序3. 选择安装路径4. 选择启动器设置5. 等待安装完成6. 启动IntelliJ IDEA7. 配置和设置8. 激活或选择许可证9. 开始使用 总结 前言 随着软件开发的不断发展&#xff0c;IntelliJ IDEA成为了许多开发人员首选…

pygame实现贪吃蛇小游戏

import pygame import random# 游戏初始化 pygame.init()# 游戏窗口设置 win_width, win_height 800, 600 window pygame.display.set_mode((win_width, win_height)) pygame.display.set_caption("Snake Game")# 颜色设置 WHITE (255, 255, 255) BLACK (0, 0, 0…

avue-tabs设置默认选中的tab

文章目录 一、问题二、解决三、最后 一、问题 最近在用avue这个UI框架来开发页面&#xff0c;有用到avue-tabs这个tab切换组件。结果竟然发现element-ui中el-tabs的v-model在avue-tabs中竟然是没有用的&#xff0c;无法设置默认选中哪个tab。avue这个基于element-ui开发的UI框…

【计算机网络笔记】802.11无线局域网

系列文章目录 什么是计算机网络&#xff1f; 什么是网络协议&#xff1f; 计算机网络的结构 数据交换之电路交换 数据交换之报文交换和分组交换 分组交换 vs 电路交换 计算机网络性能&#xff08;1&#xff09;——速率、带宽、延迟 计算机网络性能&#xff08;2&#xff09;…

制作一个RISC-V的操作系统二-RISC-V ISA介绍

文章目录 ISA的基本介绍啥是ISA为什么要设计ISACISCvsRISCISA的宽度知名ISA介绍 RISC-V历史和特点RISC-V发展RISC-V ISA 命名规范模块化的ISA通用寄存器Hart特权级别Control and Status Register&#xff08;CSR&#xff09;内存管理与保护异常和中断 ISA的基本介绍 啥是ISA …

十大经典系统架构设计面试题

十大经典系统架构设计面试题_架构_程序员石磊_InfoQ写作社区翻译自&#xff1a;https://medium.com/geekculture/top-10-system-design-interview-questions-10f7b5ea123d在我作为微软和Facebhttps://xie.infoq.cn/article/4c0c9328a725a76922f6547ad 任何 SDI 问题的提示 通过…

Elasticsearch:什么是自然语言处理(NLP)?

自然语言处理定义 自然语言处理 (natural language processing - NLP) 是人工智能 (AI) 的一种形式&#xff0c;专注于计算机和人们使用人类语言进行交互的方式。 NLP 技术帮助计算机使用我们的自然交流模式&#xff08;语音和书面文本&#xff09;来分析、理解和响应我们。 自…

OpenCV-Python:计算机视觉介绍

目录 1.背景 2.计算机视觉发展历史 3.计算机视觉主要任务 4.计算机视觉应用场景 5.知识笔记 1.背景 OpenCV是计算机视觉的一个框架&#xff0c;想要学习OpenCV&#xff0c;需要对计算机视觉有一个大致的了解。计算机视觉是指通过计算机技术和算法来模拟人类视觉系统的能力…

Go语言实现深度学习的正向传播和反向传播

文章目录 开发前言开发理论图解理论数据类型数学函数数据节点统一抽象变量数据节点常量数据节点单目运算封装双目运算封装算子节点统一抽象基础算子加法算子减法算子乘法算子除法算子指数算子对数算子正切算子正弦算子余弦算子数据流图正向传播反向传播运行示例开发总结 开发前…

甄知黄建华:从“天赋平平”到IT行业“六边形战士”,探索出企业数智化转型的“强IT”之路

本期我们先抛开人物和主体不表&#xff0c;从大环境开始谈起。随着科技的快速发展和全球商业环境的不断变化&#xff0c;中国企业对灵活性、创新性、全球化和效率的需求是迫切的&#xff0c;进行数字化转型来支撑企业的业务变革、组织优化已是业界共识。如何根据企业的实际情况…