How do I set CBAUTH_REVRPC_URL in Couchbase N1QL? - couchbase

Working with 4.0.
I ran "./cbq-engine -datastore=http://localhost:8091".
First message in the log is:
"level=ERROR msg= Unable to initialize cbauth. Error Unable to initialize cbauth's revrpc: cbauth environment variable CBAUTHREVRPC_URL is not set ".
And indeed when I try to run CREATE PRIMARY INDEX I get an error:
"Indexer not implemented GSI may not be enabled"

You should install Couchbase 4.0 and run it directly. After that, you can run cbq (not cbq-engine) as above.
You should not run cbq-engine manually.

So, in order to solve this issue you have to set a new environment variable, by doing (before calling cbq-engine)
export CBAUTH_REVRPC_URL="http://User:Pass#localhost:8091/query"
Hope this works!

Related

Cakephp 3.1 have issues with PHP7.2

I have develop my web application by using cakephp 3.1. My service provider has update the php version to 7.2. Now my application is not work well, as it was working with PHP5.6, Its showing different warnings with debug=true; and the big problem is its not showing line which have some problem, if some is there. Here is warning message.
Warning: count() [function.count]: Parameter must be an array or an object that implements Countable in D:\xampp7\htdocs\bighris\vendor\cakephp\cakephp\src\Database\QueryCompiler.php on line 115
In case some errors are there its not showing it, in the following way, there I can't find the line number and the file which have the problem.
https://www.screencast.com/t/qIQB1YIW
Please help me to solve the issue, Thanks
As per the Cakephp github issues:
PHP 7.2 has changed count's behavior
that's why you are getting errors.
PHP 7.2 has changed count's behavior causing problems with QueryCompiler
You can follow the below link or change your PHP version to 7.1 or less to resolve this issue.
Stop warnings when using count in QueryCompiler in PHP 7.2
it looks like you are passing some wrong data to count function, guess you are passing some query directly to count. Or something like that.
If you may show the code of the controller you are facing issue it may be a great help.
there is solution for you....
2020-09-30 06:22:30 Warning: Warning (2): count() [function.count]: Parameter must be an array or an object that implements Countable in [D:\xampp\htdocs\gym_master\vendor\cakephp\cakephp\src\Database\QueryCompiler.php, line 126]
please check your php version...

TEventLog does not write to systemlog

I am using Free Pascal (Lazarus) to develop a simple server daemon. The problem I am facing is that the TEventLog component does not write to the systemlog.
I use the following code:
EventLog1.LogType := ltSystem;
EventLog1.Active := True;
EventLog1.Log('Application has started!');
Instead of writing to systemlog it creates a file with the name as the executable and writes there.
Is there any other way I can write to the system log ? Is openlog defined in any unit I can use ?
(Assuming you use a *nix and the most recent 2.6.2 version).
No, libc log* functions seem only declared in the implementation of eventlog. Maybe they are in unit libc, but that is mostly unsupported, and linux/32bit only.
Check some assumptions:
Is active false before you set logtype, otherwise the active:=true might not recheck it.
you want to write system log, do you have enough privileges for that?
Do you see anything with strace/ktrace/truss ?

Strange errors when linking to libmariadb

I'm currently develop an Objective-C library that links to the MariaDB C connector. I believe there is a problem with the library, though.
Every time I execute my code I get very strange errors on the console. The -(id)init method of my library calls mysql_init(NULL) to initialise the library but as soon as I return from -(id)init I get the following errors in the console:
Object 0x10643df70 of class XXX autoreleased with no pool in place - just leaking - break on objc_autoreleaseNoPool() to debug
Thing is, there is no multithreaded code being executed and if I run the same - (id)init without the call to mysql_init(NULL) the errors disappear. I believe the libmariadb library is causing these errors to appear. I don't get why though.
Do I need to build it with any special command line switches? Am I calling the right methods? I obviously used the MySQL online documentation as a guide.
Make sure you add this anytime you have a new thread:
#autoreleasepool {
//enter code here
}
Have you tried latest revision from launchpad?
Also try to build libmariadb with -DUNDEF_THREADS_HACK and
CMAKE_USE_PTHREADS:BOOL=OFF)
I was busy with other stuff for a while. I've since updated MariaDB to the latest version and, as far as I can tell, it works fine.

Unable to apply code first migrations to mysql database

I am working on asp.net mvc with EF code first model. I am trying to apply migrations using EF code first to my project. I am using MySql database. currently i am using EF 4.3.1 version and mysql connector/.net of 6.6.4.0 version. I am successfully add migrations to my project that means i execute series of commands that gave no errors for me. I have followed these steps,
PM> Enable-Migrations
PM> Add-Migration InitialMigration
PM> update-database -verbose
these steps create Migration folder to my project and inside Migration folder it creates configuration and timestamp_Initialmigration files, in configuration file i have added following code.
SetSqlGenerator("MySql.Data.MySqlClient", new MySql.Data.Entity.MySqlMigrationSqlGenerator());
after that i have added one field to my class like,
public int newprop{get; set;}
after that i execute update-database -verbose command in PM console.
when i execute my application it throws an error like,
"Unknown column 'Extent1.newprop' in 'field list'"
please guide me why i am getting this error does i went to the wrong way please guide me.
If your not using automatic migrations
Database.SetInitializer(new MigrateDatabaseToLatestVersion());
public class MyMigrationConfiguration : DbMigrationsConfiguration<MyDbContext>
{
public MyMigrationConfiguration()
{
AutomaticMigrationsEnabled = true; // Are you using this ?????
AutomaticMigrationDataLossAllowed = true;
}
}
Then you need to tell EF using the PM Commandlet to add another migration and update the database.
PM> Enable-Migrations //already done this ?
PM> Add-Migration myLabel
PM> Update-Database
Search for "code based migrations" on web for help
This is a bit late to answer OP... But since it pops up as my first hit on google, ill go ahead anyways :)
The problem here is, that there are a number of restrictions on MySQL as compared to MSSQL.
* In particular with mysql on casesensitive filesystems (linux hosts), table names may not include capitalized letters.
* Also keys are restricted to 767 bytes and should/must be integer types.
* Then there is a problem in parts of the migration generators from Mysql.Data package. For instance when renaming, 'dbo' is not stripped away.
Have a look at this guide on insidemysql.com. It describes how to reconfigure the Aspnet.Identity stack for using int in the TKey typecast.
I have a project where i also have hooked into HistoryContext, allowing to alter structure of __MigrationHistory. It renames and resizes the table/columns. There's also the remake of IdentityConfig - so have a look at
https://github.com/mschr/ASP.NET-MVC5.MySql-Extended-Bootstrap/tree/master/my.ns.entities/DbContexts/MigrationConfig
https://github.com/mschr/ASP.NET-MVC5.MySql-Extended-Bootstrap/tree/master/my.ns.entities/IdentityConfig
Then hook it up with your context (see IdentityDbContext) and enable the mentioned MySqlMigrationScriptGenerator and HistoryContextFactory in your Migrations.Configuration class (see my IdentitiyMigrations.Configuration)

ZeosLib with MYSQL's shared memory protocol?

I started up my local MYSQL server with the shared memory protocol turned on.
How can I connect to my server with ZeosLib? Where do I specify that it is using shared-memory?
I am using Lazarus(freepascal), although the directions would be the same for Delphi (probably).
Even if the TZConnection has no connection string property you can set the additional connection parameters in TZConnection.Properties.
I presume you run your MySQL server this way
mysqld --skip-networking --shared_memory=1 --shared-memory-base-name='MyMemoryDB'
To enable your shared memory connection you might try to add the following configuration lines into the property TZConnection.Properties at design time in Object Inspector.
Note that the protocol must be set as it is and shared-memory-base-name to the same value as you used in the command line parameter. The default value is MYSQL so if you omit the parameter in command line then you should change the following MyMemoryDB values to MYSQL.
So in TZConnection.Properties property try to add these two lines
protocol=memory
shared-memory-base-name=MyMemoryDB
or at runtime in the TZConnection.BeforeConnect event handler use
procedure TForm1.ZConnection1BeforeConnect(Sender: TObject);
begin
ZConnection1.Properties.Add('protocol=memory');
ZConnection1.Properties.Add('shared-memory-base-name=MyMemoryDB');
end;
Hope this will help you somehow. I haven't tested it because I don't have the proper environment.
IF ZeOS support it, it is probably a textual property that can be added to the (TZ)connection options. Just like other clientlib properties.