通過ollama本地部署deepseek
最近公司讓我們學習部署一下deepseek,看能不能擴展一些AI新業務(個人感覺我沒這個實力??),在此記錄一下部署遇到的問題!!!
環境:本地下載ollama,然后通過ollama pull deepseek r1 模型,Linux服務器通過ragflow開源項目整合ollama接口實現大模型調用。
部署參考文檔
https://zhuanlan.zhihu.com/p/22064512226
這篇文章從頭到尾基本沒什么問題,整個流程也很簡單。
常見問題
下載緩慢
剛開始下載還很快,但速度會逐漸下降下來,直至幾K,如果你換個網絡,網速又會恢復正常,然后又逐漸下降到幾K,切換多了就會報錯:
C:\Users\Administrator>ollama run deepseek-r1:8b
pulling manifest
pulling 6340dc3229b0... 71% ▕███████████████████████████████████████ ▏ 3.5 GB/4.9 GB
Error: max retries exceeded: Get "https://dd20bb891979d25aebc8bec07b2b3bbc.r2.cloudflarestorage.com/ollama/docker/registry/v2/blobs/sha256/63/6340dc3229b0d08ea9cc49b75d4098702983e17b4c096d57afbbf2ffc813f2be/data?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=66040c77ac1b787c3af820529859349a%2F20250211%2Fauto%2Fs3%2Faws4_request&X-Amz-Date=20250211T013217Z&X-Amz-Expires=86400&X-Amz-SignedHeaders=host&X-Amz-Signature=0c6d7b537de9e43849cbaf21ffd4e8dd4e21a56b19a5bf066a3e32a38526d50b": net/http: TLS handshake timeout
解決方法:寫個powershell程序,指定間隔時間自動重新kill掉再pulling
while ($true) {
$modelExists = ollama list | Select-String "deepseek-r1:7b"
if ($modelExists) {
Write-Host "model is ready"
break
}
Write-Host "download..."
$process = Start-Process -FilePath "ollama" -ArgumentList "run", "deepseek-r1:7b" -PassThru -NoNewWindow
Start-Sleep -Seconds 60
try {
Stop-Process -Id $process.Id -Force -ErrorAction Stop
Write-Host "kill and restart..."
}
catch {
Write-Host "error"
}
}
參考鏈接:https://blog.csdn.net/cy21951612/article/details/145513664
具體參數、想法優化可以讓AI幫忙寫代碼,網上大佬杰作(膜拜???♂?):https://github.com/u-wlkjyy/ollama-fast/tree/master

docker啟動ragflow報ES的錯
ERROR 247 Elasticsearch http://es01:9200 is unhealthy in 120s.
Traceback (most recent call last)
具體錯誤:
ERROR 311 Elasticsearch http://es01:9200 is unhealthy in 120s.
Traceback (most recent call last):
File "/ragflow/rag/svr/task_executor.py", line 737, in <module>
main()
File "/ragflow/rag/svr/task_executor.py", line 713, in main
settings.init_settings()
File "/ragflow/api/settings.py", line 168, in init_settings
docStoreConn = rag.utils.es_conn.ESConnection()
File "/ragflow/rag/utils/__init__.py", line 28, in _singleton
instances[key] = cls(*args, **kw)
File "/ragflow/rag/utils/es_conn.py", line 63, in __init__
raise Exception(msg)
Exception: Elasticsearch http://es01:9200 is unhealthy in 120s.
解決措施:
按照官網的操作,
cd ragflow
docker compose -f docker/docker-compose.yml up -d
會導致es或infinity容器不啟動。
必須如下操作
cd ragflow/docker
docker compose up -d
進入到docker目錄,拉取es01鏡像,不進入到docker目錄下,是拉取不到es01鏡像的,也就導致es01啟動不了,系統監測ES健康狀態異常。

浙公網安備 33010602011771號