You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by DAVID PATTERSON <pa...@mac.com> on 2013/12/02 18:24:17 UTC

About Web Servers

I am using Fuseki to return content in support of a desired RESTful server design.

1) Can I use the imbedded server to also serve up "my" pages, or do I need to have a second server with Tomcat or something running in it?

2) If I make changes to a TDB dataset behind Fuseki, do I have to close the server gracefully in order for the data to be saved?

Thanks.

Dave P

Re: About Web Servers

Posted by Andy Seaborne <an...@apache.org>.
On 04/12/13 08:42, Andy Seaborne wrote:
> On 03/12/13 18:20, DAVID PATTERSON wrote:
>> Thanks for the info. I'll look at putting my pages in the /pages
>> directory. Is it possible to have any other services? I need an images
>> server to fetch photos and display them.

By "services", you mean addition actions on a dataset?  Not without 
coding - there isn't an extension point at that point.

Another way to use Fuseki is plain old jar in a webapp and configure the 
servlets using web.xml.

<servlet>
   <servlet-name>SPARQL Query</servlet-name>
   <servlet-class>
     org.apache.jena.fuseki.servlets.SPARQL_QueryDataset
   </servlet-class>
</servlet>

   <servlet-mapping>
     <servlet-name>SPARQL Query</servlet-name>
     <url-pattern>/mydataset/query</url-pattern>
   </servlet-mapping>

then you can mix it in with any other webapp stuff you want.  The thing 
you do need to do is, programmatically, add the dataset to be queried -- 
DatasetRegistry.get().put ....


>> What I was trying to ask (and did not succeed in expressing myself) with
>> the second question is "What is the safest way to shut down Fuseki and
>> the web service so I can backup the data that was put into my TDB
>> dataset by Fuseki.
>
> Just kill the Fuseki process.  Control-C, kill -KILL, whatever.  As it
> has to be safe against accidental failures of all kinds, there isn't
> much point of having graceful shutdown.  Just two codepaths to maintain.
>
> The distribution has a Linux start/stop service script.  "fuseki stop"
> just finds the PID and kills the process.
>
> You can back it up live by:
>
> 0/ Create directory "backups" in the servers working directory.
>
> 1/ Starting with --mgtPort=3131
>
> 2/ Poke /mgt?cmd=backup&dataset=/...' where ... is the dataset name.
>
> The server will write a compresses n-quads file as backup.
>
> e.g.
> curl -X POST 'http://localhost:3131/mgt?cmd=backup&dataset=/DATASET'
>
> This happens live - the server continues to service requests inc
> updates.  The backup is a read transaction so sees a consistent state of
> the database.  TDB only does isolation level serializable, anything less
> seems to lead to trouble eventually - TDB uses write-ahead-logging, not
> 2 phase locking, of transactions.
>
>>
>> This is a trial server, for now in my basement with only one user.
>>
>> Dave P
>
>      Andy
>
>>
>> On Dec 02, 2013, at 04:29 PM, Andy Seaborne <an...@apache.org> wrote:
>>
>>> On 02/12/13 17:24, DAVID PATTERSON wrote:
>>>> I am using Fuseki to return content in support of a desired RESTful
>>>> server design.
>>>> 1) Can I use the imbedded server to also serve up "my" pages, or do I
>>>> need to have a second server with Tomcat or something running in it?
>>>
>>> Put them in the pages/ directory.
>>>
>>>> 2) If I make changes to a TDB dataset behind Fuseki, do I have to close
>>>> the server gracefully in order for the data to be saved?
>>>
>>> Don't do that!
>>>
>>> Don't even modify the TDB dataset when Fuseki is running. Do not
>>> assume that a graceful restart will help - it won't.
>>>
>>> You will corrupt the database.
>>>
>>> Either
>>> modify via Fuseki
>>> or
>>> stop the server then modify the dataset
>>>
>>> Andy
>>>
>>>> Thanks.
>>>> Dave P
>>>
>


Re: About Web Servers

Posted by Andy Seaborne <an...@apache.org>.
On 03/12/13 18:20, DAVID PATTERSON wrote:
> Thanks for the info. I'll look at putting my pages in the /pages
> directory. Is it possible to have any other services? I need an images
> server to fetch photos and display them.
>
> What I was trying to ask (and did not succeed in expressing myself) with
> the second question is "What is the safest way to shut down Fuseki and
> the web service so I can backup the data that was put into my TDB
> dataset by Fuseki.

Just kill the Fuseki process.  Control-C, kill -KILL, whatever.  As it 
has to be safe against accidental failures of all kinds, there isn't 
much point of having graceful shutdown.  Just two codepaths to maintain.

The distribution has a Linux start/stop service script.  "fuseki stop" 
just finds the PID and kills the process.

You can back it up live by:

0/ Create directory "backups" in the servers working directory.

1/ Starting with --mgtPort=3131

2/ Poke /mgt?cmd=backup&dataset=/...' where ... is the dataset name.

The server will write a compresses n-quads file as backup.

e.g.
curl -X POST 'http://localhost:3131/mgt?cmd=backup&dataset=/DATASET'

This happens live - the server continues to service requests inc 
updates.  The backup is a read transaction so sees a consistent state of 
the database.  TDB only does isolation level serializable, anything less 
seems to lead to trouble eventually - TDB uses write-ahead-logging, not 
2 phase locking, of transactions.

>
> This is a trial server, for now in my basement with only one user.
>
> Dave P

	Andy

>
> On Dec 02, 2013, at 04:29 PM, Andy Seaborne <an...@apache.org> wrote:
>
>> On 02/12/13 17:24, DAVID PATTERSON wrote:
>>> I am using Fuseki to return content in support of a desired RESTful
>>> server design.
>>> 1) Can I use the imbedded server to also serve up "my" pages, or do I
>>> need to have a second server with Tomcat or something running in it?
>>
>> Put them in the pages/ directory.
>>
>>> 2) If I make changes to a TDB dataset behind Fuseki, do I have to close
>>> the server gracefully in order for the data to be saved?
>>
>> Don't do that!
>>
>> Don't even modify the TDB dataset when Fuseki is running. Do not
>> assume that a graceful restart will help - it won't.
>>
>> You will corrupt the database.
>>
>> Either
>> modify via Fuseki
>> or
>> stop the server then modify the dataset
>>
>> Andy
>>
>>> Thanks.
>>> Dave P
>>


Re: About Web Servers

Posted by DAVID PATTERSON <pa...@mac.com>.
Thanks for the info. I'll look at putting my pages in the /pages directory. Is it possible to have any other services? I need an images server to fetch photos and display them.

What I was trying to ask (and did not succeed in expressing myself) with the second question is "What is the safest way to shut down Fuseki and the web service so I can backup the data that was put into my TDB dataset by Fuseki.

This is a trial server, for now in my basement with only one user.

Dave P

On Dec 02, 2013, at 04:29 PM, Andy Seaborne <an...@apache.org> wrote:

> On 02/12/13 17:24, DAVID PATTERSON wrote:
>> I am using Fuseki to return content in support of a desired RESTful
>> server design.
>> 1) Can I use the imbedded server to also serve up "my" pages, or do I
>> need to have a second server with Tomcat or something running in it?
>
> Put them in the pages/ directory.
>
>> 2) If I make changes to a TDB dataset behind Fuseki, do I have to close
>> the server gracefully in order for the data to be saved?
>
> Don't do that!
>
> Don't even modify the TDB dataset when Fuseki is running. Do not
> assume that a graceful restart will help - it won't.
>
> You will corrupt the database.
>
> Either
> modify via Fuseki
> or
> stop the server then modify the dataset
>
> Andy
>
>> Thanks.
>> Dave P
>

Re: About Web Servers

Posted by Andy Seaborne <an...@apache.org>.
On 02/12/13 17:24, DAVID PATTERSON wrote:
> I am using Fuseki to return content in support of a desired RESTful
> server design.
>
> 1) Can I use the imbedded server to also serve up "my" pages, or do I
> need to have a second server with Tomcat or something running in it?

Put them in the pages/ directory.

>
> 2) If I make changes to a TDB dataset behind Fuseki, do I have to close
> the server gracefully in order for the data to be saved?

Don't do that!

Don't even modify the TDB dataset when Fuseki is running.   Do not 
assume that a graceful restart will help - it won't.

You will corrupt the database.

Either
  modify via Fuseki
or
   stop the server then modify the dataset

	Andy

>
> Thanks.
>
> Dave P