Overview
Meilisearch is a fast, open-source search engine. This guide provides scripts to start and stop Meilisearch manually. For production use, consider managing it as a systemd service.
Starting Meilisearch
Create start.sh:
#!/bin/bash
# Start Meilisearch with custom options
nohup meilisearch --http-addr 0.0.0.0:7700 --master-key="abcd123123" --http-payload-size-limit=100Gb &
--http-addr: Binds to all interfaces on port 7700.--master-key: Sets the master key for API access (use a secure key in production).--http-payload-size-limit: Increases payload limit for large imports.
Make it executable:
chmod +x start.sh
Run:
./start.sh
Stopping Meilisearch
Create stop.sh:
#!/bin/bash
# Stop Meilisearch gracefully
pid=$(ps -ef | grep meilisearch | grep -v grep | awk '{print $2}')
if [ -n "$pid" ]; then
kill "$pid"
echo "Meilisearch stopped (PID: $pid)"
else
echo "Meilisearch is not running"
fi
- This finds the process ID and sends a SIGTERM signal to stop it gracefully.
- If the process doesn’t respond, you may need to use
kill -9as a last resort.
Make it executable:
chmod +x stop.sh
Run:
./stop.sh
Checking Status
To check if Meilisearch is running:
ps aux | grep meilisearch
# Or
curl http://localhost:7700/health
Important Notes
- Security: Avoid hardcoding the master key; use environment variables:
export MEILI_MASTER_KEY="your_key"and reference it in the script. - Logs: Meilisearch logs to stdout/stderr. Redirect to a file:
nohup meilisearch ... > meilisearch.log 2>&1 & - Installation: Download from Meilisearch releases and ensure it’s in your PATH.
- Systemd Service: For better management, create a systemd unit file in
/etc/systemd/system/meilisearch.serviceand usesudo systemctl start/stop meilisearch. - Multiple Instances: The stop script assumes one instance; adjust if running multiple.
- Payload Limit: The 100Gb limit is high; adjust based on your needs.