How to increase the sizelimit of LDAP? - ldap

My ldapsearch command is only returning a max of 500 entries, while I know I > have over 24,000 entries in the database. how can I increase the sizelimit, to display all my entries. Please Provided details steps

as heiglandreas mentioned, this is a server side limit.
If you are using slapd.conf, this would be the sizelimit directive.
If you are using cn=config, this would be olcSizelimit attribute.
You can change it on the client side with -E pr=nnnn but only up to the server side limit. Some language specific tools like Perl's Net::LDAP::Control::Paged (SizeLimit exceeded using Net::LDAP::Control::Paged) can provide the tools to query in those languages.

Related

Way around the bcp/freebcp queryout Long Query String error

It's an old bug fixed in Microsoft's Q279180, that can no longer be viewed. In fact, you get that sardonic response from them.
We would like to show you a description here but the site won’t allow us.
1 - 1
https://support.microsoft.com/en-US/search/results?query=Q279180
I'm working with a very restricted read-only sources (SQL Server DBs) and no root access to mod client options on Unix; so my idea was to use the freebcp from FreeTds in the queryout mode to submit a joined sql for an extract. And of course this won't allow anything above some puny 100 characters for a query text.
Wonder, if anyone has found a way around it.

How can I reliably track the status of a newly provisioned BareMetal server using the REST API

In SL support ticket opened last year, I was looking for assistance in working around a SoftLayer issue where when my team orders Baremetal servers through some custom scripting, sometimes, the server id associated with the new BM server changes during the provisioning process, and at that point, my tooling loses track of it, and fails. In this ticket:
https://control.softlayer.com/support/tickets/21903245
I was told that I should use the global identifier instead of the server id. I finally got around to testing that, but I am seeing an issue. It would seem that I can't query the hardware status of the new server using the global identifier when I have first submitted the request, like I can with the server id.
[chrisr#ratsy tools]$ curl -k -u chrisr1:<PW> "https://api.softlayer.com/rest/v3/SoftLayer_Hardware/320526/getHardwareStatus.json"
{"id":3,"status":"DEPLOY"}
[chrisr#ratsy tools]$ curl -k -u chrisr1:<PW> "https://api.softlayer.com/rest/v3/SoftLayer_Hardware/75302613-e55a-481a-829f-967799a41968/getHardwareStatus.json"
null
However, it does work later. I ran the same query for a server that was all ready provisioned.
[chrisr#ratsy tools]$ curl -sS -k -u chrisr1:<PW> "https://api.softlayer.com/rest/v3/SoftLayer_Hardware/1ab37f37-9373-4e10-9de4-7319fffcb4f8/getHardwareStatus.json" | json_pp
{
"status" : "ACTIVE",
"id" : 5
}
I need an identifier that I can query on that is:
a) available right away, and
b) won't change
Thanks.
The Global Identifier is assigned to the hardware until the provision is complete, for this reason the request returns "null" value. But it is the identifier that would not change if the server has been re-assigned.
Apparently there not exists any identifier that you can use to track Bare Metal Servers according your requirements.
However, I can recommend to track your server provisioning through hostname that you assigned to the server.
Getting server's information
https://$user:$apiKey#api.softlayer.com/rest/v3/SoftLayer_Account/getHardware?objectFilter={"hardware":{"hostname":{"operation":"serverHostname"}}}
Method: Get
Replace: serverHostname with the server's hostname that you
defined in your order.
The response will provide information about server's identifier,
then you can check the status from server with it.
https://$user:$apiKey#api.softlayer.com/rest/v3/SoftLayer_Hardware/123123/getHardwareStatus
Method: Get
Note: You need to make sure that you don't have more than one bare metal server's with the same hostname.
You are using wrong the global identifier, the idea is you query the server repeatedly until the provisionDate is filled in, it means you call the http://sldn.softlayer.com/reference/services/SoftLayer_Hardware_Server/getObject method and review if the "provisionDate" field has been filled in, in case that the field is not filled in that means that the server is still in provisioning. Once the provisioning server has been completed the "provisionDate" field will be filled in and also the ID of the server and other data will be updated as well. So you do not need to call the getHardwareStatus method in order to know if the server is still in provisioning or completed.

How to query Intersystems Caché to obtain database and license properties?

Question
Hi,
I'm trying to determine if I can query Intersystems Caché to obtain database properties and license properties. For the database, I'm mostly interested in properties like the current size, maximum size, block size, and the directory associated with the database. For the licenses, I'm total authorized, current available, minimum available, current active users, and maximum active users.
Background
I know that details about the database and licenses are available using the System Management Portal, but I'm trying to automate some actions that depend on these details.
I know that the %FREECNT utility is available to display space statistics for the database, but the only way I'll be able to use this utility to obtain the info I need is to write a script using AWK or SED (the system is on a Unix server) and I'd like to avoid that since I'm not as well-versed in Unix scripting as I'd like to be.
I know the ^DATABASE routine and the $SYSTEM.License.ShowCounts() function are available, but I will have to use AWK and SED for these too to eliminate the text returned that I don't need. In all cases, straight SQL will return a set of data that I can iterate over that will eliminate the extraneous text that's included by the routines/functions.
Additional Info
I've written queries similar to the one below and I'm hoping there are equivalent tables for database and license that will allow me the same access:
Select * From %SYS.ProcessQuery Where Namespace = 'HL7'
I don't have access to Caché Studio, so I'm forced to use the command line on the server. I know I can use the SQL.Shell to enter SQL statements and, from the documentation, it looks like I can create routines from the command line, but I haven't found any documentation that will allow me to enter multiline statements for routines from the command line. If that's not possible, then I probably can't use routines in my solution.
Thanks for the help.
In your Caché routine, you can use Query Summary for get some license information, or other queries in class %SYSTEM.License
For Databases you can use queries from SYS.Database from %SYS namespace
I was able to get something close.
From the command line, I entered the following:
%SYS>SET rs = ##Class(%Library.ResultSet).%New()
%SYS>SET rs.ClassName = "SYS.Database"
%SYS>SET rs.QueryName = "FreeSpace"
%SYS>SET sc = rs.Prepare(rs.QueryName)
%SYS>SET sc = rs.Execute($LISTBUILD("/my/database/directory"), 0)
%SYS>WHILE rs.Next(){WRITE rs.Data("DatabaseName")," "_rs.Data("Size")," "_rs.Data("MaxSize"),!}
It's not quite as clean as I would have hoped because I have to write the entire loop on a single line, but that's better than nothing. At least the statement wraps across lines.

MySQL Log of invalid Queries

I AM NOT RUNNING THE COMMANDS FROM PHP!
I have MySQL log_error value set to /var/log/mysql/error.log
However when I connect to a database and run an SQL command, the error does not appear in the log.
SELECT *
FROM some_table
where this_is_invalid_and_will_fail="Doesn't matter because column doesn't exist!";
There are commands running from some sort of windows application. All I want to know is what invalid commands its sending to the MySQL server so that I can attempt to resolve them.
Error log doesn't do that:
https://dev.mysql.com/doc/refman/8.0/en/error-log.html
The error log contains information
indicating when mysqld was started and
stopped and also any critical errors
that occur while the server is
running.
MySQL doesn't log invalid/failed queries anywhere.
If it's for debugging purposes, you might try setting up a MySQL Proxy, which could log this I think:
http://dev.mysql.com/downloads/mysql-proxy/
Basically, there are 2 ways.
1) setup some kind of proxy, which can log error queries. There are a lot of forks of the original mysql proxy (which was mentioned by #Mchl) - https://github.com/search?utf8=%E2%9C%93&q=MySQL+Proxy Also you can find latest version of the original mysql proxy here https://github.com/mysql/mysql-proxy
I dont like this way, because its kind of too complicated for quick debug
2) you can enable general log in mysql (which will log ALL queries).
It will create big overhead and doesnt fit production requirements, but its fast and easy way to fix bugs in development environment.
Just login to your mysql and execute
SET GLOBAL general_log = 'ON';
SHOW GLOBAL VARIABLES LIKE 'general_log%';
You will see logs location, like
+------------------+------------------------+
| Variable_name | Value |
+------------------+------------------------+
| general_log | OFF |
| general_log_file | /mnt/ssd/mysql/s.log |
+------------------+------------------------+
After that execute
mysqladmin flush-logs -u root -p
When you will need to stop logs - just execute
SET GLOBAL general_log = 'OFF';
As of mysql version 5.6.3 (released 2011-10-03), there is a variable called log-raw which allows you to include invalid queries in the general query log:
https://dev.mysql.com/doc/refman/5.6/en/server-options.html#option_mysqld_log-raw
You will need to turn on general query log using general-log and general-log-file, e.g.:
[mysqld]
general-log=1
log-raw=1
general-log-file=/var/log/mysql/general.log
Could you enable the General Query Log? That should tell you everything you need to know.
This is not so trivial. The best way to do this, is to log bad queries in your application. There is no built-in way.

Mysql query to return server load average

Does anyone know of a MySQL query that returns the server's current load average?
Do you mean the actual system load average? This has nothing to do with MySQL. For example on Linux, you can get it from /proc/loadavg.
Correct me if I'm wrong, but the load average variable is a property of the machine, not the MySQL server.
So to retrieve the avg. load you should be looking for a system call, not a SQL-query.
You might want to look into this statement:
http://dev.mysql.com/doc/refman/5.1/en/show-status.html
SHOW [GLOBAL | SESSION] STATUS
[LIKE 'pattern' | WHERE expr]
SHOW STATUS provides server status information. This information also can
be obtained using the mysqladmin
extended-status command. The LIKE
clause, if present, indicates which
variable names to match. The WHERE
clause can be given to select rows
using more general conditions, as
discussed in Section 20.28,
“Extensions to SHOW Statements”. This
statement does not require any
privilege. It requires only the
ability to connect to the server.
Do you have mytop installed?
mytop is a console-based (non-gui)
tool for monitoring the threads and
overall performance of a MySQL 3.22.x,
3.23.x, and 4.x server
Mytop allows you to monitor what is happening in real time, everything from number of queries per second to key efficiency of the queries.
See Using Mytop: A MySQL Monitor