new redis migration

Signed-off-by: ale <ale@manalejandro.com>
Este commit está contenido en:
ale
2025-12-15 16:35:35 +01:00
padre ad7a1cf0a7
commit 3ce64eeb8e
Se han modificado 20 ficheros con 1021 adiciones y 712 borrados

Ver fichero

@@ -25,7 +25,6 @@ npm run index-file -- --help # Show help
| SHA1 | 40 | `5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8` |
| SHA256 | 64 | `5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8` |
| SHA512 | 128 | `b109f3bbbc244eb82441917ed06d618b9008dd09b3befd1b5e07394c706a8bb9...` |
| Bcrypt | 60 | `$2b$10$N9qo8uLOickgx2ZMRZoMye...` |
## 🔌 API Quick Reference
@@ -46,32 +45,35 @@ GET /api/health
- **Web Interface**: http://localhost:3000
- **Search API**: http://localhost:3000/api/search
- **Health API**: http://localhost:3000/api/health
- **Elasticsearch**: http://localhost:9200
- **Redis**: localhost:6379
## 📊 Elasticsearch Commands
## 📊 Redis Commands
```bash
# Health
curl http://localhost:9200/_cluster/health?pretty
# Test connection
redis-cli ping
# Index stats
curl http://localhost:9200/hasher/_stats?pretty
# Get database stats
redis-cli INFO stats
# Document count
curl http://localhost:9200/hasher/_count?pretty
# Count all keys
redis-cli DBSIZE
# Search
curl http://localhost:9200/hasher/_search?pretty
# List all hash documents
redis-cli KEYS "hash:plaintext:*"
# Delete index (CAUTION!)
curl -X DELETE http://localhost:9200/hasher
# Get document
redis-cli GET "hash:plaintext:password"
# Clear all data (CAUTION!)
redis-cli FLUSHDB
```
## 🐛 Troubleshooting
| Problem | Solution |
|---------|----------|
| Can't connect to ES | Check `ELASTICSEARCH_NODE` env var |
| Can't connect to Redis | Check `REDIS_HOST` and `REDIS_PORT` env vars |
| Port 3000 in use | Use `PORT=3001 npm run dev` |
| Module not found | Run `npm install` |
| Build errors | Run `npm run build` to see details |
@@ -82,17 +84,14 @@ curl -X DELETE http://localhost:9200/hasher
|------|---------|
| `app/page.tsx` | Main UI component |
| `app/api/search/route.ts` | Search endpoint |
| `lib/elasticsearch.ts` | ES configuration |
| `lib/hash.ts` | Hash utilities |
| `scripts/index-file.ts` | Bulk indexer |
## ⚙️ Environment Variables
| `lib/redis.ts` | Redis configuration |
```bash
# Required
ELASTICSEARCH_NODE=http://localhost:9200
# Optional
REDIS_HOST=localhost
REDIS_PORT=6379
REDIS_PASSWORD=your-password
REDIS_DB=0
NODE_ENV=production
```