I don't want to use rest API to find bucket size of couchbase. Is there any N1Q1 to find disk-used by bucket or keyspace?
https://issues.couchbase.com/browse/MB-41655, merging it now, will be available in 7.0....
Related
As pointed out in the documentation, Couchbase ejects documents from memory according to its NRU value : Couchbase - Not Recently Used (NRU) Items
I wonder if it is possible to get NRU value of the document somehow (API,etc)?
I have already a code to retrieve the objects in the bucket using oci-java-sdk and this is working as expected. I would like to retrieve the URL of the file which was uploaded to the bucket in object storage and when I use this URL, this should redirect to the actual location without asking any credentials.
I saw preauthenticated requests but again i need to create one more request. I dont want to send one more request and want to get URL in the existing GetObjectResponse.
Any suggestions>
Thanks,
js
The URL of an object is not returned from the API but can be built using information you know (See Update Below!). The pattern is:
https://{api_endpoint}/n/{namespace_name}/b/{bucket_name}/o/{object_name}
Accessing that URL will (generally, see below) require authentication. Our authentication mechanism is described at:
https://docs.cloud.oracle.com/en-us/iaas/Content/API/Concepts/signingrequests.htm
Authentication is NOT required if you configure the bucket as a Public Bucket.
https://docs.cloud.oracle.com/en-us/iaas/Content/Object/Tasks/managingbuckets.htm?TocPath=Services%7CObject%20Storage%7C_____2#publicbuckets
As you mentioned, Pre-authenticated Requests (PARs) are an option. They are generally used in this situation, and they work well.
https://docs.cloud.oracle.com/en-us/iaas/Content/Object/Tasks/usingpreauthenticatedrequests.htm
Strictly speaking, it is also possible to use our Amazon S3 Compatible API...
https://docs.cloud.oracle.com/en-us/iaas/Content/Object/Tasks/s3compatibleapi.htm
...and S3's presigned URLs to generate (without involving the API) a URL that will work without additional authentication.
https://docs.aws.amazon.com/AmazonS3/latest/dev/ShareObjectPreSignedURL.html
Update: A teammate pointed out that the OCI SDK for Java now includes a getEndpoint method that can be used to get the hostname needed when querying the Object Storage API. https://docs.cloud.oracle.com/en-us/iaas/tools/java/1.25.3/com/oracle/bmc/objectstorage/ObjectStorage.html#getEndpoint--
I want to create pre-authenticated request for an object inside a bucket in the OCI object storage using python SDK. I found out that I can use get_preauthenticated_request for the bucket to put objects inside the bucket but not to get the objects pre-authenticated. I can create a pre-authenticated request using the OCI console but I need to do it in a python script. can anybody help me in this issue?
You can use create_preauthenticated_request (see code) for both buckets and individual objects.
The difference is in the access type:
ANY_OBJECT_WRITE is for the whole bucket
OBJECT_READ, OBJECT_READ_WRITE and OBJECT_WRITE are for objects
So you should be able to create a Pre-Authenticated Request with something like
request_details = create_preauthenticated_request_details()
request_details.access_type("ObjectReadWrite")
par = create_preauthenticated_request("namespace", "bucket", request_details)
You can find more on the request details here and for the request itself here.
Let me know if this works for you, I don't have an account to test against at the moment.
I know how to do it for views, for example:
http://127.0.0.1:8092/<my_bucket>/_design/all/_view/all?full_set=true&key=<my_document_key>&connection_timeout=60000
And I tried:
http://127.0.0.1:8091/contacts/hello
(after creating via the UI a document with the key hello).
And the response was "Not Found."
What am I doing wrong?
Thanks,
Michael
There is no REST API for retrieving documents by key. You can either write your own thin service layer that uses the client SDK internally, or as of Couchbase 4.0, use the N1QL REST API to get the document through a query by key:
SELECT * FROM bucket USE KEYS [docId];
You can read about using the N1QL service endpoint here: http://developer.couchbase.com/documentation/server/4.1/n1ql/n1ql-rest-api/index.html
(Edit: Changed N1QL syntax to actually work. Thanks Gerald.)
In following way we can access couchbase document
Syntax:
hostname:8091/pools/default/buckets/{bucketname}/docs/{docid}
http://localhost:8091/pools/default/buckets/Aggregation/docs/AvgSumAssuredByProduct
Where
To access bucket related, use api: http://localhost:8091/pools/default/buckets/
Bucket Name: Aggregation
docid : AvgSumAssuredByProduct
If you want to use it for development purpose then you can use CLI or admin console (UI).
In production you should ALWAYS use language specific client SDK. Couchbase SDKs are intelligent as they have details about cluster map. Client knows before hand about which node should be used for CRUD operation.
After reading the API docs it seems that you can only list buckets from S3 in XML.
http://docs.amazonwebservices.com/AmazonS3/latest/API/index.html?RESTBucketGET.html
Since S3 is a websevicey service, surely there must be a way to do this in JSON? Or are you in fact stuck with XML?
I just found this, which might help
http://shrub.appspot.com/
-John