Downloading & installing N1QL

guys, I guess I am a bit blind here. I simply can’t find the download link for N1QL.
the download page indicated in the docs does not contain anything useful for this.
please provide a working link.

That’s because we have one better now! SQL for Documents (codename N1QL) is integrated into the Developer Preview of Couchbase Server 4.0. Download it and give it a shot. There is a good overview on @cihangirb’s blog on the topic too.

Thank you!
I managed to install it, run cbq-engine, and perform n1ql queries from cbq.
however, when trying this:

$result=$bucket->query(CouchbaseN1qlQuery::fromString("select * from `users`"));
var_dump($result);

what I get is NULL. Is there something else that I need to do?
many thanks.

Hi Avandor,

Do you have a primary index created on the bucket “users” ? If not then you need to create a primary index with the following statement :

CREATE PRIMARY INDEX ON users

Cheers,
Manik

yes, I do have the primary index.
everything works well using cbq, including explain statements and everything.

for some reason (perhaps connectivity/or libs) any command I would run from php returns NULL).
anyone else got this? or perhaps a link/howto for troubleshooting/debugging ?

here is what I get when I dump the query:

 object(CouchbaseN1qlQuery)#31040 (1) {
  ["options"]=>
  array(1) {
    ["statement"]=>
    string(33) "select uuid from `users` limit 10"
     }
 }

… and the output :frowning:

NULL

I’m playing around with n1ql and following this guide.

http://docs.couchbase.com/4.0/n1ql/getting-started.html

But it looks like there is no service running on http://localhost:8093 I can access the other ports and I get this for http://localhost:8091/pools

{"pools":[{"name":"default","uri":"/pools/default?uuid=41e6f8abc2e1051699d99914615df07a","streamingUri":"/poolsStreaming/default?uuid=41e6f8abc2e1051699d99914615df07a"}],"isAdminCreds":false,"isROAdminCreds":false,"isEnterprise":true,"settings":{"maxParallelIndexers":"/settings/maxParallelIndexers?uuid=41e6f8abc2e1051699d99914615df07a","viewUpdateDaemon":"/settings/viewUpdateDaemon?uuid=41e6f8abc2e1051699d99914615df07a"},"uuid":"41e6f8abc2e1051699d99914615df07a","implementationVersion":"4.0.0-2213-enterprise","componentsVersion":{"lhttpc":"1.3.0","os_mon":"2.2.14","public_key":"0.21","asn1":"2.0.4","kernel":"2.16.4","ale":"4.0.0-2213-enterprise","inets":"5.9.8","ns_server":"4.0.0-2213-enterprise","crypto":"3.2","ssl":"5.3.3","sasl":"2.3.4","stdlib":"1.19.4"}}%    

Do I need to download a different Couchbase or do something to enable N1QL? This was just from the easy path on the website for N1QL.

To issue N1QL queries you do need the query service enabled. Make sure all 3 are checked in your case to ensure secondary indexes are also available…

Thanks. It looks like if you install a new version on top of the old Mac double click, you never see the setup screen. To reset your installation, remove ~/Library/Application Support/Couchbase and everything works.

Where does someone find these magical checkboxes? I’ve looked all through the admin web portal and I don’t see them.

@DavidActualX when you add a new node to the cluster (or start a new cluster), you’ll see 3 checkboxes: data, query and indexing.

How would one turn Index and Query on for an existing node?

@DavidActualX you can’t do that right now, you need to remove and re-add the node.

highly unfortunate for a single node cluster :frowning:

@DavidActualX that is true. In this case if you have valuable data please perform a backup, reset the node and then re-add the data.

Note that in current builds, we’ve preselected all 3 services when a new cluster is created which will reduce the likelihood of this happening (especially in development environments). I think the current beta doesn’t have it yet, unfortunately.

Is there a way to “reset the node” without performing a reinstall?

You can, but you’ll loose the data. Depending on which OS you are its stopping the service, cleaning a dir and then starting it up. On mac it is ~/Library/Application Support/Couchbase …

What do I need to clear out on a linux install?

Try this, but do a backup first please.

/etc/init.d/couchbase-server stop ;
rm -f rm /opt/couchbase/var/lib/couchbase/ip*;
rm -f /opt/couchbase/couchbase/var/lib/couchbase/config/config.dat ;
rm -rf /opt/couchbase/var/lib/couchbase/data/ ;
/etc/init.d/couchbase-server start

Thanks @daschl. That seems to have done the trick. I’ve re-initialized the one node cluster and this time I checked the index and query options.