Question tailing microsoft/mssql-server-linux logs
See original GitHub issueSo, I’m following the pattern of using entrypoint.sh
to start and seed the server inside of a docker-compose
file. The problem I’m running into is my app resides in a separate container. So, I can’t just run npm start to keep the container alive. I’m wondering if I can do something like this:
/opt/mssql/bin/sqlservr & /app/mssql-import.sh && tail -f <MSSQL_LOGS>
Any insights are much appreciated! Been banging my head on this one for a while. Thanks!
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
how to tail mssql server logs in linux? - Stack Overflow
How to see and trace microsoft sql server logs via tail command in linux? I use the following command to see postgresql logs:...
Read more >Troubleshoot SQL Server on Linux - Microsoft Learn
In this article · Troubleshoot connection failures · Manage the SQL Server service · Access the log files · Extended events · Crash...
Read more >Tail-Log Backup and Restore in SQL Server - SQLShack
A tail-log backup is a special type of transaction log backup. In this type of backup, the log records that have not been...
Read more >Forgotten Maintenance - Cycling the SQL Server Error Log
To cycle error logs on a regular basis, restart your SQL Server nightly. Only joking. You can set up a SQL Agent job...
Read more >initdata: No memory for kernel buffers - DBA Stack Exchange
I was able to fix my install by logging in using my "normal" Linux account, ... and re-install SQL Server binaries from the...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Fix (TL;DR):
Thanks to this comment on issue #4, I discovered that reversing the two commands resolves the issue:
My thoughts & speculation:
Other tweaks & improvements (?):
Also, I wasn’t confident in that arbitrary
sleep
command inimport-data.sh
. I replaced it with the following:This loops attempting to run a
SELECT 1
statement against themaster
database. Initially it getsLogin timeout expired
errors. While I was messing around, I also sawLogin failed; invalid SA password
(or something like that). If the call is unsuccessful (non-zero exit code), it will wait 2 seconds and try again. Once that call succeeds, we can be relatively sure that the subsequent call to run thesetup.sql
script will work as well. Feels cleaner than hoping we slept long enough.Also worth mentioning, since
sqlservr
requires theSA_PASSWORD
environment variable, we should be able to safely use it in the scripts as well, instead of repeatedly hard-coding the password.@twright-msft, if you’d like to see any of these tweaks as a PR, let me know (specifically the change for the loop wait and the password variable). Obviously, the first part in reversing the commands isn’t relevant to the node demo app, but certainly helpful to know for those of us attempting to use this idea in other ways.
@bzier that seems to do the trick. Thanks! What I was doing as a workaround was this:
I also ended up with a similar check using
sqlcmd
for determining when to seed the database, but it hadn’t occurred to me to use to determine its availability—nice one!At this point, I think the original intent of my inquiry has been satisfied. I’ll go ahead and close this issue out. Thanks, @bzier & @twright-msft !