# python-redis
**Repository Path**: ChunkHsu/python-redis
## Basic Information
- **Project Name**: python-redis
- **Description**: ECUST 2023 秋季学期《数据库原理课程设计》大作业
基于python来实现一个简单的redis数据库
实现了五个基本的数据类型
- sds, - list, - hash, - set, - zset
及发布订阅(pub_sub)、
集群(简易版,仅使用websockets,使client与多台服务器进行通信)不包括主从复制、哨兵模式等功能(只有一个多星期进行大作业的完成,时间不够)
- **Primary Language**: Python
- **License**: Not specified
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 1
- **Forks**: 0
- **Created**: 2024-01-10
- **Last Updated**: 2024-03-07
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
# python-redis
### 介绍
本项目是华东理工大学2021级软件工程专业第九组的数据库原理课程作业
组长
10180824
组员
21011509
21011362
21013114
21011265
21013973
使用python实现简单的redis
启动前需安装依赖
服务端启动命令 `python ws_server.py`
客户端启动命令 `python ws_client.py`
### 测试及演示
#### 单机测试
服务端口
`124.71.176.207:1234`
#### 集群测试
`python3 ws_server.py 1234 cluster`
`python3 ws_server.py 1235 cluster`
`python3 ws_server.py 1236 cluster`
-----hash的键对应的端口,样例------
| hash到的端口 | 键 | | | |
|----------|-------|------|---|---|
| 1234 | key2 | | | |
| 1235 | keyhj | | | |
| 1236 | key | key4 | | |
### linux 启动命令
-- 后台启动
`nohup python3 ws_server.py > output.log 2>&1 &`
-- 查找启动的脚本
`ps aux | grep "ws_server.py"`
-- 使用 pkill 一次性终止所有匹配的进程。
`pkill -f "your_script.py"`
-- 查看所有端口的占用情况
`lsof -i`
-- 查看特定端口(例如,端口号 80)的占用情况
`lsof -i :80`
-- 关闭进程
`kill -9 `