[GH-ISSUE #5940] 配置命令都是什么啊 - how to keep models loaded for 24h #3706

Closed
opened 2026-04-12 14:31:11 -05:00 by GiteaMirror · 13 comments
Owner

Originally created by @673092756 on GitHub (Jul 25, 2024).
Original GitHub issue: https://github.com/ollama/ollama/issues/5940

Originally assigned to: @dhiltgen on GitHub.

我想要让ollama在服务器运行24小时不掉机,我查了所有的相关资料没有找到,希望官方出一些ollama所有的配置命令手册, 这样可以更好的使用,感谢

Originally created by @673092756 on GitHub (Jul 25, 2024). Original GitHub issue: https://github.com/ollama/ollama/issues/5940 Originally assigned to: @dhiltgen on GitHub. 我想要让ollama在服务器运行24小时不掉机,我查了所有的相关资料没有找到,希望官方出一些ollama所有的配置命令手册, 这样可以更好的使用,感谢
GiteaMirror added the question label 2026-04-12 14:31:11 -05:00
Author
Owner
<!-- gh-comment-id:2249724144 --> @liuia commented on GitHub (Jul 25, 2024): https://github.com/ollama/ollama/blob/main/docs/linux.md#adding-ollama-as-a-startup-service-recommended
Author
Owner

@673092756 commented on GitHub (Jul 25, 2024):

https://github.com/ollama/ollama/blob/main/docs/linux.md#adding-ollama-as-a-startup-service-recommended

抱歉,不知道是我的原因还是什么,我在这篇文档里面没有看到类似的操作手册,只看到如何安装

<!-- gh-comment-id:2249828647 --> @673092756 commented on GitHub (Jul 25, 2024): > https://github.com/ollama/ollama/blob/main/docs/linux.md#adding-ollama-as-a-startup-service-recommended 抱歉,不知道是我的原因还是什么,我在这篇文档里面没有看到类似的操作手册,只看到如何安装
Author
Owner

@handsomejustin commented on GitHub (Jul 25, 2024):

难道你是windows系统?下载ollama windows版本也可以保证24h不掉线的。

<!-- gh-comment-id:2250022765 --> @handsomejustin commented on GitHub (Jul 25, 2024): 难道你是windows系统?下载ollama windows版本也可以保证24h不掉线的。
Author
Owner

@eust-w commented on GitHub (Jul 25, 2024):

使用ollama serve即可

<!-- gh-comment-id:2251553961 --> @eust-w commented on GitHub (Jul 25, 2024): 使用ollama serve即可
Author
Owner

@673092756 commented on GitHub (Jul 26, 2024):

难道你是windows系统?下载ollama windows版本也可以保证24h不掉线的。

我是Linux系统

<!-- gh-comment-id:2251773709 --> @673092756 commented on GitHub (Jul 26, 2024): > 难道你是windows系统?下载ollama windows版本也可以保证24h不掉线的。 我是Linux系统
Author
Owner

@673092756 commented on GitHub (Jul 26, 2024):

使用ollama serve即可

我想要的不是ollama不掉线,想要的是运行的模型不掉线,启动一次就行了,后续可以更方便访问

<!-- gh-comment-id:2251775372 --> @673092756 commented on GitHub (Jul 26, 2024): > 使用ollama serve即可 我想要的不是ollama不掉线,想要的是运行的模型不掉线,启动一次就行了,后续可以更方便访问
Author
Owner

@jlvihv commented on GitHub (Jul 26, 2024):

You can send a message to the Ollama model at regular intervals, such as every 1 minute, similar to a heartbeat mechanism, to prevent the model from disconnecting.

<!-- gh-comment-id:2251840062 --> @jlvihv commented on GitHub (Jul 26, 2024): You can send a message to the Ollama model at regular intervals, such as every 1 minute, similar to a heartbeat mechanism, to prevent the model from disconnecting.
Author
Owner

@eust-w commented on GitHub (Jul 26, 2024):

使用ollama serve即可

我想要的不是ollama不掉线,想要的是运行的模型不掉线,启动一次就行了,后续可以更方便访问

你可以用keepalive参数 最大持续时间可以设置为 2562047h47m16.854775807s

我想这已经满足了你的需求

<!-- gh-comment-id:2251859357 --> @eust-w commented on GitHub (Jul 26, 2024): > > 使用ollama serve即可 > > 我想要的不是ollama不掉线,想要的是运行的模型不掉线,启动一次就行了,后续可以更方便访问 你可以用keepalive参数 最大持续时间可以设置为 2562047h47m16.854775807s 我想这已经满足了你的需求
Author
Owner

@673092756 commented on GitHub (Jul 26, 2024):

You can send a message to the Ollama model at regular intervals, such as every 1 minute, similar to a heartbeat mechanism, to prevent the model from disconnecting.

Do you mean setting it inside the configuration item ollama.server or writing a program?

<!-- gh-comment-id:2251870903 --> @673092756 commented on GitHub (Jul 26, 2024): > You can send a message to the Ollama model at regular intervals, such as every 1 minute, similar to a heartbeat mechanism, to prevent the model from disconnecting. Do you mean setting it inside the configuration item ollama.server or writing a program?
Author
Owner

@673092756 commented on GitHub (Jul 26, 2024):

使用ollama serve即可

我想要的不是ollama不掉线,想要的是运行的模型不掉线,启动一次就行了,后续可以更方便访问

你可以用keepalive参数 最大持续时间可以设置为 2562047h47m16.854775807s

我想这已经满足了你的需求

image
这是我设置的,但是呢,我这里不起作用,这两种方式我都试过了,模型没起来,是我设置的问题还是说写错了。你那里设置之后启动成功了吗,或者说生效了吗?

<!-- gh-comment-id:2251872360 --> @673092756 commented on GitHub (Jul 26, 2024): > > > 使用ollama serve即可 > > > > > > 我想要的不是ollama不掉线,想要的是运行的模型不掉线,启动一次就行了,后续可以更方便访问 > > 你可以用keepalive参数 最大持续时间可以设置为 2562047h47m16.854775807s > > 我想这已经满足了你的需求 ![image](https://github.com/user-attachments/assets/8e256f2f-40e5-45f1-9f30-fdb780c124cf) 这是我设置的,但是呢,我这里不起作用,这两种方式我都试过了,模型没起来,是我设置的问题还是说写错了。你那里设置之后启动成功了吗,或者说生效了吗?
Author
Owner

@eust-w commented on GitHub (Jul 26, 2024):

使用ollama serve即可

我想要的不是ollama不掉线,想要的是运行的模型不掉线,启动一次就行了,后续可以更方便访问

你可以用keepalive参数 最大持续时间可以设置为 2562047h47m16.854775807s
我想这已经满足了你的需求

image 这是我设置的,但是呢,我这里不起作用,这两种方式我都试过了,模型没起来,是我设置的问题还是说写错了。你那里设置之后启动成功了吗,或者说生效了吗?

像这样运行
ollama run llama3.1 --keepalive 2562047h47m16.854775807s 你就会看到model loaded 是forever的

<!-- gh-comment-id:2252171674 --> @eust-w commented on GitHub (Jul 26, 2024): > > > > 使用ollama serve即可 > > > > > > > > > 我想要的不是ollama不掉线,想要的是运行的模型不掉线,启动一次就行了,后续可以更方便访问 > > > > > > 你可以用keepalive参数 最大持续时间可以设置为 2562047h47m16.854775807s > > 我想这已经满足了你的需求 > > ![image](https://private-user-images.githubusercontent.com/138642126/352350865-8e256f2f-40e5-45f1-9f30-fdb780c124cf.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjE5ODAyNDUsIm5iZiI6MTcyMTk3OTk0NSwicGF0aCI6Ii8xMzg2NDIxMjYvMzUyMzUwODY1LThlMjU2ZjJmLTQwZTUtNDVmMS05ZjMwLWZkYjc4MGMxMjRjZi5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwNzI2JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDcyNlQwNzQ1NDVaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT0yZWQxOWYyNDVjNDVlZmRhZmZjY2E3YjU5YjU0M2IwNmMyOWQyMzY4MzUwNDExNDY2OGVkNjRhMzdhMGQwZDM0JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.FztlefxEqcMKz5NqXEZxj_GC0-ZdGxb2lyupmSrBNRE) 这是我设置的,但是呢,我这里不起作用,这两种方式我都试过了,模型没起来,是我设置的问题还是说写错了。你那里设置之后启动成功了吗,或者说生效了吗? 像这样运行 `ollama run llama3.1 --keepalive 2562047h47m16.854775807s ` 你就会看到model loaded 是forever的
Author
Owner

@dhiltgen commented on GitHub (Jul 26, 2024):

In addition to specifying the --keepalive flag to the run command, you can adjust the default for the server with OLLAMA_KEEP_ALIVE on the server. On linux you configure the server through the systemd file described here https://github.com/ollama/ollama/blob/main/docs/faq.md#setting-environment-variables-on-linux

<!-- gh-comment-id:2253491732 --> @dhiltgen commented on GitHub (Jul 26, 2024): In addition to specifying the `--keepalive` flag to the run command, you can adjust the default for the server with OLLAMA_KEEP_ALIVE on the server. On linux you configure the server through the systemd file described here https://github.com/ollama/ollama/blob/main/docs/faq.md#setting-environment-variables-on-linux
Author
Owner

@673092756 commented on GitHub (Jul 29, 2024):

In addition to specifying the --keepalive flag to the run command, you can adjust the default for the server with OLLAMA_KEEP_ALIVE on the server. On linux you configure the server through the systemd file described here https://github.com/ollama/ollama/blob/main/docs/faq.md#setting-environment-variables-on-linux

This method works, thank you so much, it didn't work before should be my version.

<!-- gh-comment-id:2255052383 --> @673092756 commented on GitHub (Jul 29, 2024): > In addition to specifying the `--keepalive` flag to the run command, you can adjust the default for the server with OLLAMA_KEEP_ALIVE on the server. On linux you configure the server through the systemd file described here https://github.com/ollama/ollama/blob/main/docs/faq.md#setting-environment-variables-on-linux This method works, thank you so much, it didn't work before should be my version.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#3706