gcloud sql create instance : POSTGRES_9_6 is not a valid value - google-compute-engine

I see that the POSTGRES database option for gce sql is still in BETA, just looking for confermation that the issue mentioned below is an issue with the API and not something stupid I've overlooked.
gcloud sql instances create example-db --activation-policy=ALWAYS --tier="db-n1-standard-1" --pricing-plan="PER_USE" --region="asia-east1" --gce-zone="asia-east1-a" --database-version=POSTGRES_9_6
HTTPError 400: Invalid value for: POSTGRES_9_6 is not a valid value
Documentation says that this is a valid option:
- https://cloud.google.com/sdk/gcloud/reference/sql/instances/create

Found more documentation that explains I needed to use the gcloud beta command syntax.
https://cloud.google.com/sql/docs/postgres/create-instance
Actual Working Example
gcloud beta sql instances create example-db --activation-policy=ALWAYS --pricing-plan="PER_USE" --region="asia-east1" --gce-zone="asia-east1-a" --cpu=2 --memory=3840MiB --database-version="POSTGRES_9_6"

Related

Can't create instance from java sdk

I am trying to create an OCI instance with the Java SDK. I am getting an error in routeRules.
When I commented the following line, I was able to create an instance. But in that machines route is not enabled.
addInternetGatewayToRouteTable(vcnClient, compartmentId, vcn.getDefaultRouteTableId(), internetGateway);
https://github.com/oracle/oci-java-sdk/blob/master/bmc-examples/src/main/java/CreateInstanceExample.java
Exception in thread "main" com.oracle.bmc.model.BmcException: (400, InvalidParameter, false) routeRules[0].networkEntityId may not be null (opc-request-id: 6BC8A182852240F8AFFD1EB279CFF901/AD5BF82603D64DA298976FCFE83871F6/9398B04078B0435A8FA68FEA7307CC99)
at com.oracle.bmc.http.internal.ResponseHelper.throwIfNotSuccessful(ResponseHelper.java:120)
at com.oracle.bmc.http.internal.ResponseConversionFunctionFactory$ValidatingParseResponseFunction.apply(ResponseConversionFunctionFactory.java:86)
at com.oracle.bmc.http.internal.ResponseConversionFunctionFactory$ValidatingParseResponseFunction.apply(ResponseConversionFunctionFactory.java:82)
at com.oracle.bmc.core.internal.http.UpdateRouteTableConverter$1.apply(UpdateRouteTableConverter.java:70)
at com.oracle.bmc.core.internal.http.UpdateRouteTableConverter$1.apply(UpdateRouteTableConverter.java:55)
at com.oracle.bmc.core.VirtualNetworkClient.updateRouteTable(VirtualNetworkClient.java:3325)
at CreateInstanceExample.addInternetGatewayToRouteTable(CreateInstanceExample.java:295)
at CreateInstanceExample.main(CreateInstanceExample.java:146)
There is a bug in the code, you can replace destination in the addInternetGatewayToRouteTable(..) method
RouteRule internetAccessRoute =
RouteRule.builder()
.cidrBlock("0.0.0.0/0")
.destination(internetGateway.getId())
.build();
in line 295 with networkEntityId:
RouteRule internetAccessRoute =
RouteRule.builder()
.cidrBlock("0.0.0.0/0")
.networkEntityId(internetGateway.getId())
.build();
You can see from the REST APIs here which parameters are required to create a route rule in a route table.
The example seems to be based on a deprecated version of calling the RouteRule builder.

Working on migration of SPL 3.0 to 4.2 (TEDA)

I am working on migration of 3.0 code into new 4.2 framework. I am facing a few difficulties:
How to do CDR level deduplication in new 4.2 framework? (Note: Table deduplication is already done).
Where to implement PostDedupProcessor - context or chainsink custom? In either case, do I need to remove duplicate hashcodes from the list or just reject the tuples? Here I am also doing column updating for a few tuples.
My file is not moving into archive. The temporary output file is getting generated and that too empty and outside load directory. What could be the possible reasons? - I have thoroughly checked config parameters and after putting logs, it seems correct output is being sent from transformer custom, so I don't know where it is stuck. I had printed TableRowGenerator stream for logs(end of DataProcessor).
1. and 2.:
You need to select the type of deduplication. It is not a big difference if you choose "table-" or "cdr-level-deduplication".
The ite.businessLogic.transformation.outputType does affect this. There is one Dedup only. You can not have both.
Select recordStream for "cdr-level-deduplication", do the transformation to table row format (e.g. if you like to use the TableFileWriter) in xxx.chainsink.custom::PostContextDataProcessor.
In xxx.chainsink.custom::PostContextDataProcessor you need to add custom code for duplicate-handling: reject (discard) tuples or set special column values or write them to different target tables.
3.:
Possibly reasons could be:
Missing forwarding of window punctuations or statistic tuple
error in BloomFilter configuration, you would see it easily because PE is down and error log gives hints about wrong sha2 functions be used
To troubleshoot your ITE application, I recommend to enable the following debug sinks if checking the StreamsStudio live graph is not sufficient:
ite.businessLogic.transformation.debug=on
ite.businessLogic.group.debug=on
ite.businessLogic.sink.debug=on
Run a test with a single input file only and check the flow of your record and statistic tuples. "Debug sinks" write punctuations markers also to debug files.

Google Compute Engine API - Filtering Instances or Other Lists Using Labels / Tags

With the gcloud command line tool I can do:
$ gcloud compute instances list --filter='tags.items:development'
The documentation claims: "..you can also filter on nested fields. For example, you could filter on instances that have set the scheduling.automaticRestart field to true. Use filtering on nested fields to take advantage of labels to organize and search for results based on label values." But no examples are provided, so it's not clear how one actually goes about this.
I've tried labels.development eq *.*, labels eq *development*, labels:development et al.. I've also tried setting the verbosity of the of the command line client to info and looking through the output, as well as monitoring requests that go to the API from the Compute Engine web console, but neither has gotten me anywhere.
Finding Tags with regular expression filters
I'm struggling with the same issue but I think that regular expressions solve the problem.
I have many instances with multiple tags but I can search across all tags with the '~' operator e.g. to find all servers with the production tag:
gcloud compute instances list --filter='tags.items~^production$'
For many servers the 'production' tag is the third entry in tags.items yet the regexp finds it.
This seems to work but I can't find any documentation that specifically says that it should work. The nearest is the section on topic filters which mentions this
key ~ value True if key matches the RE (regular expression) pattern
value.
You can also search for multiple tags
gcloud compute instances list --filter='tags.items~^production$ AND tags.items~^european$'
which would find all servers with the two tags 'production' and 'european'
Tags v Custom metadata
If you want something a bit more flexible than tags (which can only be present or missing), you can attach your own custom multi-valued metadata to an instance (via the UI, command-line or API). You can then search for particular values of that item.
For example suppose I have different instances supporting eCommerce for different brands, I could attach a custom 'brand' metadata item to each server and then find all of the servers which run my "Coca-Cola" brands via ..
gcloud compute instances list --filter="metadata.items.key['brand']['value']='Coca-Cola'"
... and my 'Pepsi Cola' servers with ...
gcloud compute instances list --filter="metadata.items.key['brand']['value']='Pepsi Cola'"
Finding Metadata with regular expression filters
You probably guessed this already but the regular expression operator also works with metadata filters so you can do
gcloud compute instances list --filter="metadata.items.key['brand']['value']~'Cola'"
As explained here you can use the following syntax using gcloud cli:
gcloud compute instances list --filter labels.env=dev
Multi Filtering example that I'm using:
gcloud compute instances list --filter="zone:( europe-west1-d )" --filter="name:( testvm )" --filter labels.group=devops --filter labels.environment_type=production
Add instance metadata MyKey=MyValue for gke-cluster-asia-eas-default-pool-dc8f484c-knbs:
gcloud compute instances add-metadata gke-cluster-asia-eas-default-pool-dc8f484c-knbs --metadata=MyKey=MyValue
Display all instances with MyKey=MyValue:
gcloud compute instances list --filter="metadata.items.key['MyKey'][value]='MyValue'"
Display all instances that belong to the cluster cluster-asia-east1-a:
gcloud compute instances list --filter="metadata.items.key['cluster-name'][value]='cluster-asia-east1-a'"
NAME ZONE MACHINE_TYPE PREEMPTIBLE INTERNAL_IP EXTERNAL_IP STATUS
gke-cluster-asia-eas-default-pool-dc8f484c-knbs asia-east1-a n1-standard-1 10.140.0.2 104.155.227.25 RUNNING
gke-cluster-asia-eas-default-pool-dc8f484c-x8cv asia-east1-a n1-standard-1 10.140.0.3 104.199.226.16 RUNNING
gke-cluster-asia-eas-default-pool-dc8f484c-z5wv asia-east1-a n1-standard-1 10.140.0.4 104.199.134.9 RUNNING

ImageId not found in Google Compute Engine using Jclouds

I'm creating instance on the Google Compute Engine with jclouds, using the command:
Template template = context.getComputeService().templateBuilder().imageId("debian-7-wheezy-v20150710").build();
Set<? extends NodeMetadata> listNode = context.getComputeService().createNodesInGroup("teste", 1, template);
But is the error below:
2015-08-16 07:27:04 INFO compute:64 - Image debian-7-wheezy-v20150710 not found in the image cache. Trying to get it from the provider...
Exception in thread "main" java.util.NoSuchElementException: imageId(debian-7-wheezy-v20150710) not found
at org.jclouds.compute.domain.internal.TemplateBuilderImpl.throwNoSuchElementExceptionAfterLoggingImageIds(TemplateBuilderImpl.java:764)
at org.jclouds.compute.domain.internal.TemplateBuilderImpl.findImageWithId(TemplateBuilderImpl.java:745)
at org.jclouds.compute.domain.internal.TemplateBuilderImpl.build(TemplateBuilderImpl.java:688)
at br.com.clouddeploy.main.TestGoogle.main(TestGoogle.java:47)
Any suggestion?
If you are using imageId() you probably need to use the full path to the image. Here's how to find it:
% gcloud compute images list --uri | grep debian-7
shows:
https://www.googleapis.com/compute/v1/projects/debian-cloud/global/images/backports-debian-7-wheezy-v20150710
https://www.googleapis.com/compute/v1/projects/debian-cloud/global/images/debian-7-wheezy-v20150710
So you can use either of these. The one that starts with backports has newer versions of packages, but is still based on Debian 7 Wheezy.
Alternatively, it looks like jclouds has the ability to do this URL creation on its own, but instead of using imageId(), you should use (see GitHub code example):
ComputeService compute = initComputeService(account, credentials);
[...]
TemplateBuilder templateBuilder = compute.templateBuilder();
templateBuilder.fromImage(compute
.getImage("debian-7-wheezy-v20140408"));

Connecting to a remote MySQL server from a Delphi program through SSL

I don't have a good knowledge of SSL principles, but just want the encryption to work for me.
I have a DB and a user with "REQUIRE X509" specified.
The necessary certificates have been created as described in MySQL docs, and work well - i can connect to the server from Windows command line.
The problem arises, when i try to do the same from my program using MySQL Client API (without SSL, the program also works fine).
The unit used is: http://www.audio-data.de/mysql.html.
These are my action paths:
1) if i just add mysql_ssl_set() call (with proper params) before mysql_real_connect(), the last one gives generic SSL Connection Error.
2) the MySQL docs in en/mysql-ssl-set.html say, that the function always returns 0. But when i checked that, it appeared that the result is the number 11150848. Then i wrote it like that:
showmessage(inttostr(mysql_ssl_set(mys, '.\certs\client-key.pem', '.\certs\client-cert.pem', '.\certs\ca-cert.pem', nil)));
...and repeated the line 8 times.
Each time it returned a slightly greater number - 11158528, 11158784, 11159040, ... and two zeroes for the last two calls.
After which mysql_real_connect() was finally successful! The program even managed to execute some queries, return proper results for them (i know the data), but then it crashed with an Access Violation: write of address ... at some place.
The crash point varied between runs and slight changes to code.
It looks much like a version incompatibility issue. I tried libraries from both MySQL 5.0 and 5.1 Windows installations (the server is 5.1 and runs under Linux remotely; however, 5.0 mysql-client programs do not have troubles when SSL-connecting to it), but with no success.
Is anybody familiar with the issue? Thanks a lot for the help & sorry for the mistakes in the question.
As I see the mysql_ssl_set declaration is incorrect. It is declared:
function mysql_ssl_set(_mysql: PMYSQL; key, cert, ca, capath: PAnsiChar): longint; stdcall;
But the mysql.h contains:
my_bool STDCALL mysql_ssl_set(MYSQL *mysql, const char *key,
const char *cert, const char *ca,
const char *capath, const char *cipher);
That explains the garbage in return value, AV's and so on.