档案数字化项目忙炸遇数字档案馆系统账号被锁定?别慌!5步落地解决方案救场
做档案数字化批量挂接、移交前格式校验时最糟心的是什么?肯定是正赶deadline,鼠标键盘敲得飞起,突然弹出“账号已被锁定,请联系管理员重置”的提示窗。别盯着报错框抓头发啦,今天整理的这份贴合主流厂商...
2026年09月08日 15:55:31
本系统采用B/S架构,前端使用Vue 3 + Element Plus,后端使用Spring Boot 2.7,数据库选用MySQL 8.0,文件存储采用MinIO对象存储。
确保服务器满足以下最低配置:
执行以下命令安装OpenJDK 17:
``` Ubuntu/Debian sudo apt update sudo apt install openjdk-17-jdk -y CentOS/RHEL sudo yum install java-17-openjdk-devel -y ```验证安装:
``` java -version ```安装MySQL 8.0并配置:
``` Ubuntu/Debian wget https://dev.mysql.com/get/mysql-apt-config_0.8.24-1_all.deb sudo dpkg -i mysql-apt-config_0.8.24-1_all.deb sudo apt update sudo apt install mysql-server -y CentOS/RHEL sudo rpm -Uvh https://dev.mysql.com/get/mysql80-community-release-el7-6.noarch.rpm sudo yum install mysql-community-server -y ```启动并设置开机自启:
``` sudo systemctl start mysqld sudo systemctl enable mysqld ```获取初始密码并修改:
``` sudo grep 'temporary password' /var/log/mysqld.log mysql -u root -p ALTER USER 'root'@'localhost' IDENTIFIED BY 'YourNewPassword123!'; ```创建MinIO安装目录并下载:
``` mkdir -p /opt/minio/data cd /opt/minio wget https://dl.min.io/server/minio/release/linux-amd64/minio chmod +x minio ```创建启动脚本/etc/systemd/system/minio.service:
``` [Unit] Description=MinIO After=network.target [Service] Type=simple User=root ExecStart=/opt/minio/minio server /opt/minio/data --console-address ":9001" Restart=on-failure [Install] WantedBy=multi-user.target ```启动MinIO:
``` sudo systemctl daemon-reload sudo systemctl start minio sudo systemctl enable minio ```访问http://服务器IP:9001,使用默认账号密码(minioadmin/minioadmin)登录,立即修改密码。
登录MySQL执行:
``` CREATE DATABASE digital_archive DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; CREATE USER 'archive_user'@'%' IDENTIFIED BY 'Archive@Pass123'; GRANT ALL PRIVILEGES ON digital_archive. TO 'archive_user'@'%'; FLUSH PRIVILEGES; ```创建archive_tables.sql文件:
``` -- 档案分类表 CREATE TABLE archive_category ( id BIGINT PRIMARY KEY AUTO_INCREMENT, category_code VARCHAR(50) NOT NULL UNIQUE, category_name VARCHAR(100) NOT NULL, parent_id BIGINT DEFAULT 0, sort_order INT DEFAULT 0, created_time DATETIME DEFAULT CURRENT_TIMESTAMP, INDEX idx_parent (parent_id) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- 档案文件表 CREATE TABLE archive_file ( id BIGINT PRIMARY KEY AUTO_INCREMENT, file_name VARCHAR(255) NOT NULL, file_path VARCHAR(500) NOT NULL, file_size BIGINT NOT NULL, file_type VARCHAR(50), file_hash VARCHAR(64) COMMENT 'SHA256文件哈希', category_id BIGINT NOT NULL, upload_user VARCHAR(50), upload_time DATETIME DEFAULT CURRENT_TIMESTAMP, description TEXT, INDEX idx_category (category_id), INDEX idx_upload_time (upload_time) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- 档案借阅记录表 CREATE TABLE archive_borrow ( id BIGINT PRIMARY KEY AUTO_INCREMENT, file_id BIGINT NOT NULL, borrower VARCHAR(50) NOT NULL, borrow_time DATETIME DEFAULT CURRENT_TIMESTAMP, return_time DATETIME, purpose VARCHAR(500), status TINYINT DEFAULT 1 COMMENT '1:借阅中 2:已归还', INDEX idx_file (file_id), INDEX idx_borrower (borrower) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; ```导入数据库:
``` mysql -u archive_user -p digital_archive < archive_tables.sql ```下载Spring Boot应用包:
``` cd /opt wget https://your-domain.com/archive-backend-1.0.0.jar ```创建配置文件application-prod.yml:
``` server: port: 8080 spring: datasource: url: jdbc:mysql://localhost:3306/digital_archive?useUnicode=true&characterEncoding=utf8&useSSL=false username: archive_user password: Archive@Pass123 driver-class-name: com.mysql.cj.jdbc.Driver servlet: multipart: max-file-size: 1GB max-request-size: 1GB minio: endpoint: http://localhost:9000 accessKey: your-minio-access-key secretKey: your-minio-secret-key bucketName: archive-files logging: level: com.archive: DEBUG file: name: /var/log/archive/archive.log ```创建/etc/systemd/system/archive-backend.service:
``` [Unit] Description=Digital Archive Backend Service After=network.target mysqld.service minio.service [Service] Type=simple User=root WorkingDirectory=/opt ExecStart=/usr/bin/java -jar -Dspring.profiles.active=prod archive-backend-1.0.0.jar Restart=on-failure RestartSec=10 [Install] WantedBy=multi-user.target ```启动服务:
``` sudo systemctl daemon-reload sudo systemctl start archive-backend sudo systemctl enable archive-backend ```验证服务是否启动:
``` curl http://localhost:8080/api/health ```
安装Nginx并配置:
``` Ubuntu/Debian sudo apt install nginx -y CentOS/RHEL sudo yum install nginx -y ```下载前端构建文件:
``` cd /var/www wget https://your-domain.com/archive-frontend-dist.zip unzip archive-frontend-dist.zip ```创建Nginx配置文件/etc/nginx/conf.d/archive.conf:
``` server { listen 80; server_name your-domain.com; root /var/www/archive-frontend; index index.html; location / { try_files $uri $uri/ /index.html; } location /api/ { proxy_pass http://localhost:8080; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } location /minio/ { proxy_pass http://localhost:9000; proxy_set_header Host $host; } } ```重启Nginx:
``` sudo nginx -t sudo systemctl restart nginx ```创建迁移目录结构:
``` mkdir -p /mnt/migration/{documents,images,videos} ```按照以下规则组织文件:
创建导入脚本import_archives.py:
``` !/usr/bin/env python3 import os import hashlib import requests from pathlib import Path API_BASE = "http://localhost:8080/api" UPLOAD_URL = f"{API_BASE}/files/upload" def calculate_file_hash(filepath): sha256_hash = hashlib.sha256() with open(filepath, "rb") as f: for byte_block in iter(lambda: f.read(4096), b""): sha256_hash.update(byte_block) return sha256_hash.hexdigest() def upload_file(filepath, category_id): filename = os.path.basename(filepath) filesize = os.path.getsize(filepath) filehash = calculate_file_hash(filepath) with open(filepath, 'rb') as f: files = {'file': (filename, f)} data = { 'categoryId': category_id, 'description': f'迁移文件: {filename}' } response = requests.post(UPLOAD_URL, files=files, data=data) if response.status_code == 200: print(f"✓ 成功上传: {filename}") else: print(f"✗ 上传失败: {filename} - {response.text}") 执行导入 if __name__ == "__main__": 设置分类ID对应关系 categories = { 'documents': 1, 'images': 2, 'videos': 3 } base_path = "/mnt/migration" for category_name, category_id in categories.items(): category_path = os.path.join(base_path, category_name) if os.path.exists(category_path): for filename in os.listdir(category_path): filepath = os.path.join(category_path, filename) if os.path.isfile(filepath): upload_file(filepath, category_id) ```运行导入脚本:
``` python3 import_archives.py ```登录系统后执行以下验证步骤:
修改MySQL配置/etc/my.cnf:
``` [mysqld] innodb_buffer_pool_size = 4G innodb_log_file_size = 256M innodb_flush_log_at_trx_commit = 2 max_connections = 500 query_cache_type = 1 query_cache_size = 128M slow_query_log = 1 slow_query_log_file = /var/log/mysql/slow.log long_query_time = 2 ```创建备份脚本/opt/backup_archive.sh:
``` !/bin/bash BACKUP_DIR="/backup/archive" DATE=$(date +%Y%m%d_%H%M%S) 备份数据库 mysqldump -u archive_user -p'Archive@Pass123' digital_archive > \ ${BACKUP_DIR}/db_backup_${DATE}.sql 压缩备份文件 gzip ${BACKUP_DIR}/db_backup_${DATE}.sql 保留最近30天备份 find ${BACKUP_DIR} -name ".sql.gz" -mtime +30 -delete ```设置定时任务:
``` crontab -e 每天凌晨2点执行备份 0 2 /bin/bash /opt/backup_archive.sh ```创建监控脚本/opt/check_status.sh:
``` !/bin/bash LOG_FILE="/var/log/archive/status.log" echo "=== 系统状态检查 $(date) ===" >> $LOG_FILE 检查服务状态 systemctl status archive-backend >> $LOG_FILE 2>&1 echo "" >> $LOG_FILE 检查磁盘空间 df -h / >> $LOG_FILE echo "" >> $LOG_FILE 检查内存使用 free -m >> $LOG_FILE ```问题1:文件上传失败
检查步骤:
问题2:数据库连接失败
检查步骤:
问题3:前端无法访问
检查步骤: