microsoft / mssql-docker

Official Microsoft repository for SQL Server in Docker resources
MIT License
1.73k stars 756 forks source link

Enable replication, sql agent, etc. #27

Closed gigatexal closed 6 years ago

gigatexal commented 7 years ago

Is the above possible? Can the Linux version of sql server do replication or run agent jobs? If so how?

twright-msft commented 7 years ago

The SQL Server Agent will be included in the mid-Feb or mid-March release.

gigatexal commented 7 years ago

Awesome. I will look for it then.

gigatexal commented 7 years ago

Will transactional replication also be supported?

gigatexal commented 7 years ago

(I'd edit my comments if it would let me on mobile) I'd like to suggest support for both the SQL agent and transactional replication (merge would be nice too) on the windows container as well.

gigatexal commented 7 years ago

Gave a presentation on running sql on Linux and the only things that are holding us back is full replication support and sql agent jobs (although we could get around that pretty easily with SQLCMD pointing to the containerized instance).

gigatexal commented 7 years ago

Sql agent comes in march or so but is there a target month for replication (as a publisher)?

twright-msft commented 7 years ago

Agent should come next week, barring any last minute show stopper issues. We will work on all aspects of replication for next month's release and see how far we can get.

gigatexal commented 7 years ago

Awesome! Much appreciated. I continue to watch the project very closely and be an advocate for its use at work. Good luck and thanks for the update.

gigatexal commented 7 years ago

Saw the announcement of HA for the Linux sql containers, and that the developer sku came back for the windows side, is replication on track for the Linux sql containers?

twright-msft commented 7 years ago

Yes, Always On Availability Groups was released for SQL Server on Linux in CTP 1.3 on Feb 17. That covers installs on RHEL, SLES, and Ubuntu, but not in containers just yet. There is a dependency on Pacemaker. We are working with Red Hat to figure out the best way forward for providing HA in containers. There are several different options ranging from using Pacemaker in the container to leveraging Kubernetes services like Stateful Sets.

Yes, the Developer SKU is available on Windows containers again now. Sorry for the delay on getting that out there again. We had some internal wrangling about that to sort out. You can get it here now: https://hub.docker.com/r/microsoft/mssql-server-windows-developer

We were tracking having the SQL Server agent released in the 1.3 release but it didnt quite make it. We are shooting for the 1.4 release in mid-March now. That is a prerequisite for replication to be fully operational on Linux.

Stay tuned!

gigatexal commented 7 years ago

@twright-msft thank you for the transparency. And good luck with 1.4 and replication!

This might be outside of the scope of this particular issue but I was curious as to why the linux docker implementation of SQLServer is so much smaller than the docker images for SQLServer but on windows? Is there a paper or some resource I could read?

twright-msft commented 7 years ago

The reason that the SQL Server on Linux image is so much smaller is because it is the engine only. It doesnt currently include agent, full text search, the clustering pieces required for WSFC, localization packs, etc. The current version of the Windows containers for SQL Server simply downloads and installs SQL Server as part of the docker build. In the future, we will likely create a similarly optimized SQL Server image for SQL on Windows.

gigatexal commented 7 years ago

That makes sense. Thanks for the insight.

richmurph commented 7 years ago

Maybe a bit off topic too but any plans to run SQL Server Containers on Nano base image? Just curious as windowsservercore is over 4 GB. Also, SQL Server Agent on the Windows container still not released?

twright-msft commented 7 years ago

@richmurph - It's something we are considering but no concrete plans yet for Nano-based image. Quite a bit of testing required for that and we would need to change the way the image is created. It would need to be a "ADD" approach as opposed to a RUN that executes the .exe. Nano doesnt support MSI.

Agent on Windows containers is on the list of things to look into as well, but for now, sorry, it's not working.

Crawl, walk, run...

gunnarmorling commented 7 years ago

Hey @twright-msft, is there any update on the addition of SQL Server Agent to the Docker image? The last mention above indicated March; is there any more recent estimate of its availability? Thanks!

rohitsinha54 commented 7 years ago

I am also looking for being able to run sql agent to try some change data capture feature. Is there any update on the availability?

twright-msft commented 7 years ago

Current thinking is that we would just have a base image - mssql-server-linux. People can then create their own images that add the combination of additional packages they require - i.e. agent +fts, fts+ha, integration services + agent, etc. There will be several different packages so creating images that cover all the combinatorial of them all seems like overkill. Please let us know what you all think about that....

To add to that... we are testing these packages in container to ensure that they work in a container if they are installed.

gigatexal commented 7 years ago

That works for me. Just throw up a guide on how to do it and I'll give it a shot. I liked the idea of a modular system

rohitsinha54 commented 7 years ago

I detailed guide on how to do it will be helpful

richmurph commented 7 years ago

Useful article here on how to do this guys. Simply installing the required features within a windows server core base image and then building a container image from completed build. http://searchsqlserver.techtarget.com/tip/Use-these-commands-to-deploy-SQL-Server-Docker-containers

thorntonrp commented 7 years ago

Is there a way install the full-text search? I'd really like to be able to experiment with this feature.

twright-msft commented 7 years ago

@thorntonrp - two options: 1) build your own image with FTS in it using the Dockerfile at the link here. 2) SSH into the container and install mssql-server-fts

grandtiger commented 7 years ago

Does this image support R service (in-database)? I tried to follow the instruction here: https://docs.microsoft.com/en-us/sql/advanced-analytics/tutorials/rtsql-working-with-inputs-and-outputs, but kept getting the following error: "SQL Server was unable to communicate with the LaunchPad service. Please verify the configuration of the service. "

twright-msft commented 7 years ago

Neither the Windows- nor the Linux-based image have support for running R/Python in them yet.

davidabbey commented 6 years ago

I have had this same issue. I think, but am not certain, that it is because I have SQL2016/SMSS installed on my host machine. I run trhe same container on a different machine w/o SqlServer/SSMS on it and do not encounter the error. Also, I have not gotten it when I stop the SQLServer service on my host machine.

hartman17 commented 6 years ago

Has there been an official guide published on installing SQL Agent in the standard SQL Server - Linux docker image?

Following guides from blogs and now I'm getting Error: The evaluation period has expired and the container does not start.

twright-msft commented 6 years ago

@hartman17 - Please use the latest Dockerfile here: https://github.com/Microsoft/mssql-docker/blob/master/linux/preview/examples/mssql-agent-fts-ha-tools/Dockerfile

darkguy2008 commented 6 years ago

Hi @twright-msft , thanks for your answers. I did use your dockerfile ( https://github.com/Microsoft/mssql-docker/blob/master/linux/preview/examples/mssql-agent-fts-ha-tools/Dockerfile ) as base but even though the SQL Agent is displayed, I can't enable it (using user sa), here's how it looks:

image

This is on normal Docker for Windows in Linux-based containers.

I also tried to make it a "master" server with an invalid result as well (Invalid namespace):

image

Dockerfile

FROM ubuntu:16.04
RUN export DEBIAN_FRONTEND=noninteractive && \
    apt-get update && \
    apt-get install -yq curl apt-transport-https && \
    curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - && \
    curl https://packages.microsoft.com/config/ubuntu/16.04/mssql-server-2017.list | tee /etc/apt/sources.list.d/mssql-server.list && \
    apt-get update -y && \
    apt-get install -y mssql-server && \
    apt-get clean && \
    rm -rf /var/lib/apt/lists && \
    /opt/mssql/bin/mssql-conf set sqlagent.enabled true  && \
    /opt/mssql/bin/mssql-conf set sqlagent.errorlogginglevel 4
CMD /opt/mssql/bin/sqlservr

docker-compose.yml

version: '3'
services:
  db:
    container_name: XXXXXXXXX
    build: .
    environment:
      - ACCEPT_EULA=Y
      - SA_PASSWORD=XXXXXXXXX
      - MSSQL_PID=Standard
    ports: 
      - 1433:1433
    volumes:
      - ./data:/var/opt/mssql
    networks:
      internal:
        aliases:
          - XXXXXXXXX

networks:
  internal:
    external: true

Any ideas?

twright-msft commented 6 years ago

On Linux, you also need to enable the Agent using this env var: MSSQL_AGENT_ENABLED=true https://docs.microsoft.com/en-us/sql/linux/sql-server-linux-configure-environment-variables?view=sql-server-2017#environment-variables

hitokiri commented 5 years ago

Hello, I have the same problem the sqlmanage starts but I am not able to give start enable_but_no_update

the same problem as here:

https://github.com/Microsoft/mssql-docker/issues/27#issuecomment-427774480

docker-compose

version: "3.7"
services:
  sqlserver:
    image: sql-server
    build: ./Sqlserver
    container_name: sql-server
    hostname: Sqlserver
    ports:
    - "1433:1433"
    tty: true
    environment:
    - 'ACCEPT_EULA=Y'
    - 'SA_PASSWORD=1234PW!'
    - 'MSSQL_AGENT_ENABLED=true'
    - 'MSSQL_PID=Standard
icastel commented 5 years ago

I'm running into this very issue with Azure Container Instances AND local Docker containers. The strange thing is that I have one container, C1, where I use 'MSSQL_AGENT_ENABLED=true' and the agent starts and works correctly. I deployed a second container, C2, in the exact same way, using the same image, and also setting 'MSSQL_AGENT_ENABLED=true'. C2 shows SQL Server Agent as disabled. Any ideas as to why this is happening? This is very frustrating. cnt

sschwenker commented 5 years ago

Has anyone gotten this going? I've tried getting this going but I keep getting this error.

image

As a side note. I used this(chrigu/mssql-agent-fts-ha-tools) image as it's a copy of the one linked here.

banerjeeamit commented 5 years ago

Replication doesn't exist for SQL Server 2017 Linux. This is being introduced for SQL Server 2019.

vin-yu commented 5 years ago

@sschwenker - you will need the SQL Server 2019 container image. Try this using this container image mcr.microsoft.com/mssql/server:2019-CTP3.1-ubuntu

Also here are examples to get SQL Server Replication in Containers up and running. https://github.com/microsoft/sql-server-samples/tree/master/samples/containers/replication https://dbafromthecold.com/2018/12/13/setting-up-sql-server-replication-in-containers/

Susanthab commented 5 years ago

Is there an official docker image for SQL Server 2019-CTP with SQL Server Agent enabled?

vin-yu commented 5 years ago

@Susanthab try this:

sudo docker run -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=<YourStrong!Passw0rd>' \
   -e 'MSSQL_AGENT_ENABLED=true' \
   -p 1433:1433 --name sql1 \
   -d mcr.microsoft.com/mssql/server:2017-latest
Susanthab commented 5 years ago

@vin-yu I'm running this as a container in AKS. So do I have to create another docker image and use that?

vin-yu commented 5 years ago

@susanthab No, just add an environment variable 'MSSQL_AGENT_ENABLED=true' when you start the SQL Server pod definition/yaml and SQL Server Agent should be started.

Susanthab commented 5 years ago

Fantastic! Thanks @vin-yu

brook-w commented 4 years ago

sqlserver 2019 Red Hat images Is it possible to publish and subscribe? Collaboration with technical staff (Microsoft) but not effective progress

croblesm commented 4 years ago

sqlserver 2019 Red Hat images Is it possible to publish and subscribe? Collaboration with technical staff (Microsoft) but not effective progress

You can retrieve the list of RHEL published images through command line, here are a few examples:

Using bash:

curl -L https://mcr.microsoft.com/v2/mssql/rhel/server/tags/list/

Using PoSh:

$rhel_response = Invoke-WebRequest -URI https://mcr.microsoft.com/v2/mssql/rhel/server/tags/list/
$rhel_response.content

You can also check the Red Hat Container registry here.